public class DefaultSpacePartition extends Object implements InternalSpacePartition
| Constructor and Description |
|---|
DefaultSpacePartition(Space space,
int partitionId) |
| Modifier and Type | Method and Description |
|---|---|
void |
addSpaceInstance(SpaceInstance spaceInstance) |
SpaceInstance |
getBackup()
Returns the (first) backup space instance,
null if currently there is no
backup. |
SpaceInstance[] |
getInstances()
Returns all the space instances that form the partition.
|
int |
getPartitionId()
Returns the partition id (starting from 0).
|
SpaceInstance |
getPrimary()
Returns the primary space instance,
null if currently there is no primary. |
Space |
getSpace()
Returns the Space this Space Partition is part of.
|
InternalSpacePartitionModeChangedEventManager |
getSpaceModeChanged()
Returns an event manager allowing to globally register for
SpaceModeChangedEventListeners that happen on any Space partition
currently discovered. |
Iterator<SpaceInstance> |
iterator() |
void |
removeSpaceInstance(String uid) |
boolean |
waitFor(SpaceMode spaceMode)
Waits (default timeout) till one of the Space partition instances has the provided space mode.
|
boolean |
waitFor(SpaceMode spaceMode,
long timeout,
TimeUnit timeUnit)
Waits (given timeout) till one of the Space partition instances has the provided space mode.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic DefaultSpacePartition(Space space, int partitionId)
public Space getSpace()
SpacePartitiongetSpace in interface SpacePartitionpublic SpaceInstance getPrimary()
SpacePartitionnull if currently there is no primary.getPrimary in interface SpacePartitionpublic SpaceInstance getBackup()
SpacePartitionnull if currently there is no
backup.getBackup in interface SpacePartitionpublic boolean waitFor(SpaceMode spaceMode)
SpacePartitionwaitFor in interface SpacePartitionspaceMode - the requested space mode (PRIMARY / BACKUP)true if a space instance was found in the default timeout, false otherwise.public boolean waitFor(SpaceMode spaceMode, long timeout, TimeUnit timeUnit)
SpacePartitionwaitFor in interface SpacePartitionspaceMode - the requested space mode (PRIMARY / BACKUP)timeout - the time to wait based on the time unittimeUnit - the time unit to use for the timeout parametertrue if a space instance was found in the specified timeout, false otherwise.public Iterator<SpaceInstance> iterator()
iterator in interface Iterable<SpaceInstance>public SpaceInstance[] getInstances()
SpacePartitiongetInstances in interface SpacePartitionpublic int getPartitionId()
SpacePartitionSpaceInstance.getInstanceId()
starts from 1.getPartitionId in interface SpacePartitionpublic void addSpaceInstance(SpaceInstance spaceInstance)
addSpaceInstance in interface InternalSpacePartitionpublic void removeSpaceInstance(String uid)
removeSpaceInstance in interface InternalSpacePartitionpublic InternalSpacePartitionModeChangedEventManager getSpaceModeChanged()
SpacePartitionSpaceModeChangedEventListeners that happen on any Space partition
currently discovered.getSpaceModeChanged in interface SpacePartitionCopyright © GigaSpaces.