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
SpaceModeChangedEventListener s 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, wait
forEach, spliterator
public DefaultSpacePartition(Space space, int partitionId)
public Space getSpace()
SpacePartition
getSpace
in interface SpacePartition
public SpaceInstance getPrimary()
SpacePartition
null
if currently there is no primary.getPrimary
in interface SpacePartition
public SpaceInstance getBackup()
SpacePartition
null
if currently there is no
backup.getBackup
in interface SpacePartition
public boolean waitFor(SpaceMode spaceMode)
SpacePartition
waitFor
in interface SpacePartition
spaceMode
- 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)
SpacePartition
waitFor
in interface SpacePartition
spaceMode
- 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()
SpacePartition
getInstances
in interface SpacePartition
public int getPartitionId()
SpacePartition
SpaceInstance.getInstanceId()
starts from 1.getPartitionId
in interface SpacePartition
public void addSpaceInstance(SpaceInstance spaceInstance)
addSpaceInstance
in interface InternalSpacePartition
public void removeSpaceInstance(String uid)
removeSpaceInstance
in interface InternalSpacePartition
public InternalSpacePartitionModeChangedEventManager getSpaceModeChanged()
SpacePartition
SpaceModeChangedEventListener
s that happen on any Space partition
currently discovered.getSpaceModeChanged
in interface SpacePartition
Copyright © GigaSpaces.