org.codehaus.wadi.location.partitionmanager.facade
Class VersionAwarePartitionFacade

java.lang.Object
  extended by org.codehaus.wadi.location.partitionmanager.facade.VersionAwarePartitionFacade
All Implemented Interfaces:
PartitionFacade, Partition

public class VersionAwarePartitionFacade
extends java.lang.Object
implements PartitionFacade

Version:
$Revision:1815 $

Nested Class Summary
protected  class VersionAwarePartitionFacade.PartitionRunnable
           
 
Constructor Summary
VersionAwarePartitionFacade(int key, Dispatcher dispatcher, PartitionInfo partitionInfo, long partitionUpdateWaitTime)
           
 
Method Summary
 Envelope exchange(SessionRequestMessage request, long timeout)
          Send a message/request to the Partition and wait for a message/response...
 int getKey()
           
 PartitionInfo getPartitionInfo()
           
protected  void handleVersionTooHigh(Envelope message, SessionRequestMessage request, java.lang.Runnable attemptAction, java.util.concurrent.CountDownLatch latch)
           
protected  void handleVersionTooLow(Envelope message, SessionResponseMessage responseMessage)
           
 boolean isLocal()
           
 void onMessage(Envelope message, DeleteIMToPM request)
          A Peer has destroyed a Session...
 void onMessage(Envelope message, EvacuateIMToPM request)
          A Peer wishes to evacuate a Session...
 void onMessage(Envelope message, InsertIMToPM request)
          A Peer has created a Session...
 void onMessage(Envelope message, MoveIMToPM request)
          A Peer has an Invocation for a Session of which it is not the owner...
protected  void onMessage(Envelope message, SessionRequestMessage request, java.lang.Runnable attemptAction, VersionAwarePartitionFacade.PartitionRunnable delegateAction)
           
 Partition setContent(PartitionInfo partitionInfo, LocalPartition content)
           
 Partition setContentRemote(PartitionInfo partitionInfo, Peer peer)
           
 void setPartitionInfo(PartitionInfo partitionInfo)
           
protected  Partition setPartitionInfo(PartitionInfo partitionInfo, Partition partition)
           
 boolean waitForBoot(long attemptPeriod)
           
protected  Envelope waitForUpdateAndExchange(SessionRequestMessage request, long timeout, java.util.concurrent.CountDownLatch latch)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VersionAwarePartitionFacade

public VersionAwarePartitionFacade(int key,
                                   Dispatcher dispatcher,
                                   PartitionInfo partitionInfo,
                                   long partitionUpdateWaitTime)
Method Detail

waitForBoot

public boolean waitForBoot(long attemptPeriod)
                    throws java.lang.InterruptedException
Specified by:
waitForBoot in interface PartitionFacade
Throws:
java.lang.InterruptedException

exchange

public Envelope exchange(SessionRequestMessage request,
                         long timeout)
                  throws MessageExchangeException
Description copied from interface: Partition
Send a message/request to the Partition and wait for a message/response...

Specified by:
exchange in interface Partition
Parameters:
request - The request
timeout - The number of milliseconds to wait for a response
Returns:
the response
Throws:
MessageExchangeException

getKey

public int getKey()
Specified by:
getKey in interface Partition
Returns:
the Partition 'key' - a number between '0' and 'numPartitions-1'

isLocal

public boolean isLocal()
Specified by:
isLocal in interface Partition
Returns:
whether or not this is a LocalPartition

onMessage

public void onMessage(Envelope message,
                      DeleteIMToPM request)
Description copied from interface: Partition
A Peer has destroyed a Session...

Specified by:
onMessage in interface Partition

onMessage

public void onMessage(Envelope message,
                      EvacuateIMToPM request)
Description copied from interface: Partition
A Peer wishes to evacuate a Session...

Specified by:
onMessage in interface Partition

onMessage

public void onMessage(Envelope message,
                      InsertIMToPM request)
Description copied from interface: Partition
A Peer has created a Session...

Specified by:
onMessage in interface Partition

onMessage

public void onMessage(Envelope message,
                      MoveIMToPM request)
Description copied from interface: Partition
A Peer has an Invocation for a Session of which it is not the owner...

Specified by:
onMessage in interface Partition

setContent

public Partition setContent(PartitionInfo partitionInfo,
                            LocalPartition content)
Specified by:
setContent in interface PartitionFacade

setContentRemote

public Partition setContentRemote(PartitionInfo partitionInfo,
                                  Peer peer)
Specified by:
setContentRemote in interface PartitionFacade

getPartitionInfo

public PartitionInfo getPartitionInfo()
Specified by:
getPartitionInfo in interface PartitionFacade

setPartitionInfo

public void setPartitionInfo(PartitionInfo partitionInfo)
Specified by:
setPartitionInfo in interface PartitionFacade

setPartitionInfo

protected Partition setPartitionInfo(PartitionInfo partitionInfo,
                                     Partition partition)

waitForUpdateAndExchange

protected Envelope waitForUpdateAndExchange(SessionRequestMessage request,
                                            long timeout,
                                            java.util.concurrent.CountDownLatch latch)
                                     throws MessageExchangeException
Throws:
MessageExchangeException

onMessage

protected void onMessage(Envelope message,
                         SessionRequestMessage request,
                         java.lang.Runnable attemptAction,
                         VersionAwarePartitionFacade.PartitionRunnable delegateAction)

handleVersionTooHigh

protected void handleVersionTooHigh(Envelope message,
                                    SessionRequestMessage request,
                                    java.lang.Runnable attemptAction,
                                    java.util.concurrent.CountDownLatch latch)

handleVersionTooLow

protected void handleVersionTooLow(Envelope message,
                                   SessionResponseMessage responseMessage)


Copyright © 2010. All Rights Reserved.