org.codehaus.wadi.location.partitionmanager
Class SimplePartitionManager

java.lang.Object
  extended by org.codehaus.wadi.location.partitionmanager.SimplePartitionManager
All Implemented Interfaces:
Lifecycle, PartitionManager, PartitionManagerMessageListener

public class SimplePartitionManager
extends java.lang.Object
implements PartitionManager, PartitionManagerMessageListener

A Simple PartitionManager.

Author:
Jules Gosnell

Field Summary
 
Fields inherited from interface org.codehaus.wadi.location.partitionmanager.PartitionManager
NAME
 
Constructor Summary
SimplePartitionManager(ServiceSpace serviceSpace, int numPartitions, PartitionMapper mapper, PartitionBalancerSingletonServiceHolder singletonServiceHolder, SimplePartitionManagerTiming timing)
           
 
Method Summary
protected  PartitionBalancingInfo buildBalancingInfo()
           
protected  void doOnPartitionBalancingInfoUpdate(Envelope om, PartitionBalancingInfoUpdate infoUpdate)
           
 void evacuate()
           
 PartitionBalancingInfo getBalancingInfo()
           
 Partition getPartition(java.lang.Object key)
           
 ServiceSpace getServiceSpace()
           
protected  java.util.Map<Peer,java.util.Set<PartitionInfo>> identifyTransfers(PartitionInfo[] newPartitionInfos)
           
protected  void initializePartitionFacades()
           
 void onPartitionBalancingInfoUpdate(Envelope om, PartitionBalancingInfoUpdate infoUpdate)
           
 void onPartitionEvacuationRequest(Envelope om, PartitionEvacuationRequest request)
           
 void onPartitionTransferRequest(Envelope om, PartitionTransferRequest request)
           
 void onRetrieveBalancingInfoEvent(Envelope om, RetrieveBalancingInfoEvent infoEvent)
           
protected  void queueRebalancing()
           
protected  void redefineLocalUnchangedPartitions(PartitionInfo[] newPartitionInfos)
           
protected  void redefineRemotePartitions(PartitionInfo[] newPartitionInfos)
           
protected  void repopulate(LocalPartition[] toBePopulated)
           
protected  void repopulatePartition(PartitionInfo[] newPartitionInfos, PartitionInfoUpdate[] updates)
           
 void start()
           
 void stop()
           
protected  void transferPartitions(PartitionInfo[] newPartitionInfos)
           
protected  void transferPartitionToPeers(Peer peer, java.util.Set<PartitionInfo> partitionInfos)
           
protected  void waitForBoot()
           
protected  void waitForElectionOfPartitionBalancerSingleton()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimplePartitionManager

public SimplePartitionManager(ServiceSpace serviceSpace,
                              int numPartitions,
                              PartitionMapper mapper,
                              PartitionBalancerSingletonServiceHolder singletonServiceHolder,
                              SimplePartitionManagerTiming timing)
Method Detail

start

public void start()
           throws java.lang.Exception
Specified by:
start in interface Lifecycle
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Specified by:
stop in interface Lifecycle
Throws:
java.lang.Exception

evacuate

public void evacuate()
Specified by:
evacuate in interface PartitionManager

onPartitionEvacuationRequest

public void onPartitionEvacuationRequest(Envelope om,
                                         PartitionEvacuationRequest request)
Specified by:
onPartitionEvacuationRequest in interface PartitionManagerMessageListener

onRetrieveBalancingInfoEvent

public void onRetrieveBalancingInfoEvent(Envelope om,
                                         RetrieveBalancingInfoEvent infoEvent)
Specified by:
onRetrieveBalancingInfoEvent in interface PartitionManagerMessageListener

onPartitionBalancingInfoUpdate

public void onPartitionBalancingInfoUpdate(Envelope om,
                                           PartitionBalancingInfoUpdate infoUpdate)
Specified by:
onPartitionBalancingInfoUpdate in interface PartitionManagerMessageListener

onPartitionTransferRequest

public void onPartitionTransferRequest(Envelope om,
                                       PartitionTransferRequest request)
Specified by:
onPartitionTransferRequest in interface PartitionManagerMessageListener

getBalancingInfo

public PartitionBalancingInfo getBalancingInfo()
Specified by:
getBalancingInfo in interface PartitionManager

getPartition

public Partition getPartition(java.lang.Object key)
Specified by:
getPartition in interface PartitionManager

getServiceSpace

public ServiceSpace getServiceSpace()

waitForElectionOfPartitionBalancerSingleton

protected void waitForElectionOfPartitionBalancerSingleton()
                                                    throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

queueRebalancing

protected void queueRebalancing()

waitForBoot

protected void waitForBoot()
                    throws java.lang.InterruptedException,
                           PartitionManagerException
Throws:
java.lang.InterruptedException
PartitionManagerException

initializePartitionFacades

protected void initializePartitionFacades()

buildBalancingInfo

protected PartitionBalancingInfo buildBalancingInfo()

doOnPartitionBalancingInfoUpdate

protected void doOnPartitionBalancingInfoUpdate(Envelope om,
                                                PartitionBalancingInfoUpdate infoUpdate)
                                         throws MessageExchangeException,
                                                PartitionBalancingException
Throws:
MessageExchangeException
PartitionBalancingException

transferPartitions

protected void transferPartitions(PartitionInfo[] newPartitionInfos)
                           throws MessageExchangeException,
                                  PartitionBalancingException
Throws:
MessageExchangeException
PartitionBalancingException

repopulatePartition

protected void repopulatePartition(PartitionInfo[] newPartitionInfos,
                                   PartitionInfoUpdate[] updates)
                            throws MessageExchangeException,
                                   PartitionBalancingException
Throws:
MessageExchangeException
PartitionBalancingException

repopulate

protected void repopulate(LocalPartition[] toBePopulated)
                   throws MessageExchangeException,
                          PartitionRepopulationException
Throws:
MessageExchangeException
PartitionRepopulationException

redefineRemotePartitions

protected void redefineRemotePartitions(PartitionInfo[] newPartitionInfos)

redefineLocalUnchangedPartitions

protected void redefineLocalUnchangedPartitions(PartitionInfo[] newPartitionInfos)

transferPartitionToPeers

protected void transferPartitionToPeers(Peer peer,
                                        java.util.Set<PartitionInfo> partitionInfos)
                                 throws MessageExchangeException,
                                        PartitionBalancingException
Throws:
MessageExchangeException
PartitionBalancingException

identifyTransfers

protected java.util.Map<Peer,java.util.Set<PartitionInfo>> identifyTransfers(PartitionInfo[] newPartitionInfos)


Copyright © 2010. All Rights Reserved.