org.codehaus.wadi.dindex.impl
Class SimplePartitionManager

java.lang.Object
  extended byorg.codehaus.wadi.dindex.impl.SimplePartitionManager
All Implemented Interfaces:
PartitionConfig, PartitionManager

public class SimplePartitionManager
extends Object
implements PartitionManager, PartitionConfig

A Simple PartitionManager.

Author:
jules

Nested Class Summary
static interface SimplePartitionManager.Callback
           
 
Field Summary
protected  boolean _allowRegenerationOfMissingPartitions
           
protected  SimplePartitionManager.Callback _callback
           
protected  Cluster _cluster
           
protected  PartitionManagerConfig _config
           
protected static String _correlationIDMapKey
           
protected  Dispatcher _dispatcher
           
protected  Map _distributedState
           
protected  long _inactiveTime
           
protected  Log _log
           
protected  PartitionMapper _mapper
           
protected  String _nodeName
           
protected  int _numPartitions
           
protected static String _partitionKeysKey
           
protected  PartitionFacade[] _partitions
           
protected  LockManager _pmSyncs
           
protected static String _timeStampKey
           
 
Constructor Summary
SimplePartitionManager(Dispatcher dispatcher, int numPartitions, Map distributedState, SimplePartitionManager.Callback callback, PartitionMapper mapper)
           
 
Method Summary
protected  void correlateStateUpdate(Map state)
           
 Collection[] createResultSet(int numPartitions, int[] keys)
           
 void evacuate()
           
 Cluster getCluster()
           
 Dispatcher getDispatcher()
           
 long getInactiveTime()
           
 String getLocalNodeName()
           
 String getNodeName(Destination destination)
           
 int getNumPartitions()
           
 PartitionFacade getPartition(int partition)
           
 PartitionFacade getPartition(Object key)
           
 PartitionKeys getPartitionKeys()
           
 LockManager getPMSyncs()
           
 void init(PartitionManagerConfig config)
           
 void localise()
           
 void markExistingPartitions(Node[] nodes, boolean[] partitionIsPresent)
           
 void onPartitionEvacuationRequest(ObjectMessage om, PartitionEvacuationRequest request)
           
 void onPartitionRepopulateRequest(ObjectMessage om, PartitionRepopulateRequest request)
           
 void onPartitionTransferCommand(ObjectMessage om, PartitionTransferCommand command)
           
 void onPartitionTransferRequest(ObjectMessage om, PartitionTransferRequest request)
           
 void regenerateMissingPartitions(Node[] living, Node[] leaving)
           
 void repopulate(Destination location, Collection[] keys)
           
 void start()
           
 void stop()
           
 void update(Node node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_partitionKeysKey

protected static final String _partitionKeysKey
See Also:
Constant Field Values

_timeStampKey

protected static final String _timeStampKey
See Also:
Constant Field Values

_correlationIDMapKey

protected static final String _correlationIDMapKey
See Also:
Constant Field Values

_nodeName

protected final String _nodeName

_log

protected final Log _log

_numPartitions

protected final int _numPartitions

_partitions

protected final PartitionFacade[] _partitions

_cluster

protected final Cluster _cluster

_dispatcher

protected final Dispatcher _dispatcher

_distributedState

protected final Map _distributedState

_inactiveTime

protected final long _inactiveTime

_allowRegenerationOfMissingPartitions

protected final boolean _allowRegenerationOfMissingPartitions
See Also:
Constant Field Values

_callback

protected final SimplePartitionManager.Callback _callback

_mapper

protected final PartitionMapper _mapper

_pmSyncs

protected final LockManager _pmSyncs

_config

protected PartitionManagerConfig _config
Constructor Detail

SimplePartitionManager

public SimplePartitionManager(Dispatcher dispatcher,
                              int numPartitions,
                              Map distributedState,
                              SimplePartitionManager.Callback callback,
                              PartitionMapper mapper)
Method Detail

init

public void init(PartitionManagerConfig config)
Specified by:
init in interface PartitionManager

start

public void start()
           throws Exception
Specified by:
start in interface PartitionManager
Throws:
Exception

evacuate

public void evacuate()
              throws Exception
Specified by:
evacuate in interface PartitionManager
Throws:
Exception

stop

public void stop()
          throws Exception
Specified by:
stop in interface PartitionManager
Throws:
Exception

getPartition

public PartitionFacade getPartition(int partition)
Specified by:
getPartition in interface PartitionManager

onPartitionEvacuationRequest

public void onPartitionEvacuationRequest(ObjectMessage om,
                                         PartitionEvacuationRequest request)

onPartitionRepopulateRequest

public void onPartitionRepopulateRequest(ObjectMessage om,
                                         PartitionRepopulateRequest request)

onPartitionTransferCommand

public void onPartitionTransferCommand(ObjectMessage om,
                                       PartitionTransferCommand command)

onPartitionTransferRequest

public void onPartitionTransferRequest(ObjectMessage om,
                                       PartitionTransferRequest request)

createResultSet

public Collection[] createResultSet(int numPartitions,
                                    int[] keys)

update

public void update(Node node)
Specified by:
update in interface PartitionManager

markExistingPartitions

public void markExistingPartitions(Node[] nodes,
                                   boolean[] partitionIsPresent)

regenerateMissingPartitions

public void regenerateMissingPartitions(Node[] living,
                                        Node[] leaving)
Specified by:
regenerateMissingPartitions in interface PartitionManager

getPartitionKeys

public PartitionKeys getPartitionKeys()
Specified by:
getPartitionKeys in interface PartitionManager

repopulate

public void repopulate(Destination location,
                       Collection[] keys)

localise

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

correlateStateUpdate

protected void correlateStateUpdate(Map state)

getNumPartitions

public int getNumPartitions()
Specified by:
getNumPartitions in interface PartitionManager

getPartition

public PartitionFacade getPartition(Object key)
Specified by:
getPartition in interface PartitionManager

getDispatcher

public Dispatcher getDispatcher()
Specified by:
getDispatcher in interface PartitionConfig

getCluster

public Cluster getCluster()
Specified by:
getCluster in interface PartitionConfig

getNodeName

public String getNodeName(Destination destination)
Specified by:
getNodeName in interface PartitionConfig

getInactiveTime

public long getInactiveTime()
Specified by:
getInactiveTime in interface PartitionConfig

getLocalNodeName

public String getLocalNodeName()
Specified by:
getLocalNodeName in interface PartitionConfig

getPMSyncs

public LockManager getPMSyncs()
Specified by:
getPMSyncs in interface PartitionConfig


Copyright © 2004-2006 Core Developers Network Ltd.. All Rights Reserved.