public class DefaultSpace extends Object implements InternalSpace
DEFAULT_HISTORY_SIZE, DEFAULT_MONITOR_INTERVAL
Constructor and Description |
---|
DefaultSpace(InternalSpaces spaces,
String uid,
String name) |
Modifier and Type | Method and Description |
---|---|
void |
addInstance(SpaceInstance spaceInstance) |
void |
addLifecycleListener(SpaceInstanceLifecycleEventListener eventListener)
Allows to add
SpaceInstanceLifecycleEventListener . |
Admin |
getAdmin() |
SpaceStatistics |
getBackupsStatistics()
Returns an aggregated view of all the statistics of the backup instances.
|
GigaSpace |
getGigaSpace()
Returns the clustered view of the space to operate on.
|
IJSpace |
getIJSpace() |
SpaceInstance[] |
getInstances()
Returns all the space instances that are currently discovered that are part of this Space
topology.
|
SpaceInstanceStatisticsChangedEventManager |
getInstanceStatisticsChanged()
Allows to register for space instance level statistics
SpaceInstanceStatisticsChangedEvent s. |
String |
getName()
Returns the name of the Space.
|
int |
getNumberOfBackups()
Returns the number of backups per Space Instance.
|
int |
getNumberOfInstances()
Returns the number of instances as per the Space topology.
|
SpacePartition |
getPartition(int partitionId)
Returns a partition for a specific partition id.
|
SpacePartition[] |
getPartitions()
Returns all the partitions that form this Space topology.
|
SpaceStatistics |
getPrimariesStatistics()
Returns an aggregated view of all the statistics of the primary instances.
|
SpaceReplicationManager |
getReplicationManager()
Returns a replication manager for this space.
|
ReplicationStatusChangedEventManager |
getReplicationStatusChanged()
Allows to globally register for each
SpaceInstance ReplicationStatusChangedEvent . |
SpaceRuntimeDetails |
getRuntimeDetails()
Returns an aggregated view of all the Space runtime details of all primary instances.
|
int |
getSize()
Returns the number of currently discovered space instances.
|
SpaceInstanceAddedEventManager |
getSpaceInstanceAdded()
Allows to registered
SpaceInstanceAddedEventListener
to be notified when space instances are added. |
SpaceInstance |
getSpaceInstanceByUid(String uid)
returns the Space instance based on its uid (see
GridComponent.getUid() ) |
SpaceInstanceRemovedEventManager |
getSpaceInstanceRemoved()
Allows to registered
SpaceInstanceRemovedEventListener
to be notified when space instances are removed. |
SpaceInstance[] |
getSpaceInstances() |
SpaceModeChangedEventManager |
getSpaceModeChanged()
Allows to globally regsiter for each
SpaceInstance SpaceModeChangedEvent . |
Spaces |
getSpaces()
Returns the spaces this space is one of.
|
SpaceStatistics |
getStatistics()
Returns an aggregated view of all the statistics of all the instances.
|
SpaceStatisticsChangedEventManager |
getStatisticsChanged()
Allows to register for aggregated Space level statistics
SpaceStatisticsChangedEvent . |
int |
getTotalNumberOfInstances()
Returns the total number of instances.
|
String |
getUid()
Returns the uid of the Space.
|
boolean |
isEmpty()
Returns
true if there are currently no space instances discovered. |
boolean |
isMonitoring()
Returns
true if statistics are now being monitored. |
Iterator<SpaceInstance> |
iterator() |
void |
refreshScheduledSpaceMonitors() |
InternalSpaceInstance |
removeInstance(String uid) |
void |
removeLifecycleListener(SpaceInstanceLifecycleEventListener eventListener)
Allows to remove
SpaceInstanceLifecycleEventListener . |
void |
setStatisticsHistorySize(int historySize)
Sets the history size of number of statistics stored.
|
void |
setStatisticsInterval(long interval,
TimeUnit timeUnit)
Sets the statistics interval, automatically updating the monitoring scheduled tasks if
monitoring is enabled.
|
void |
startStatisticsMonitor()
Starts the statistics monitor, starting a scheduled monitor that polls for statistics.
|
void |
stopStatisticsMonitor()
Stops the statistics monitor.
|
boolean |
waitFor(int numberOfSpaceInstances)
Waits till at least the provided number of Space Instances are up.
|
boolean |
waitFor(int numberOfSpaceInstances,
long timeout,
TimeUnit timeUnit)
Waits till at least the provided number of Space Instances are up for the specified timeout.
|
boolean |
waitFor(int numberOfSpaceInstances,
SpaceMode spaceMode)
Waits till at least the provided number of Space Instances that are of the space mode type
are up.
|
boolean |
waitFor(int numberOfSpaceInstances,
SpaceMode spaceMode,
long timeout,
TimeUnit timeUnit)
Waits till at least the provided number of Space Instances are of the space mode type are up
for the specified timeout.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public DefaultSpace(InternalSpaces spaces, String uid, String name)
public Spaces getSpaces()
Space
public String getUid()
Space
public String getName()
Space
public void setStatisticsInterval(long interval, TimeUnit timeUnit)
StatisticsMonitor
setStatisticsInterval
in interface StatisticsMonitor
public void setStatisticsHistorySize(int historySize)
StatisticsMonitor
setStatisticsHistorySize
in interface StatisticsMonitor
public void startStatisticsMonitor()
StatisticsMonitor
startStatisticsMonitor
in interface StatisticsMonitor
public void stopStatisticsMonitor()
StatisticsMonitor
stopStatisticsMonitor
in interface StatisticsMonitor
public boolean isMonitoring()
StatisticsMonitor
true
if statistics are now being monitored.isMonitoring
in interface StatisticsMonitor
public int getNumberOfInstances()
Space
getNumberOfInstances
in interface Space
public int getNumberOfBackups()
Space
getNumberOfBackups
in interface Space
public int getTotalNumberOfInstances()
Space
Space.getNumberOfInstances()
. If there are backups, will return Space.getNumberOfInstances()
*
(Space.getNumberOfBackups()
+ 1)getTotalNumberOfInstances
in interface Space
public SpaceInstance[] getInstances()
Space
getInstances
in interface Space
public Iterator<SpaceInstance> iterator()
iterator
in interface Iterable<SpaceInstance>
public SpacePartition[] getPartitions()
Space
getPartitions
in interface Space
public SpacePartition getPartition(int partitionId)
Space
getPartition
in interface Space
public SpaceModeChangedEventManager getSpaceModeChanged()
Space
SpaceInstance
SpaceModeChangedEvent
.getSpaceModeChanged
in interface Space
public ReplicationStatusChangedEventManager getReplicationStatusChanged()
Space
SpaceInstance
ReplicationStatusChangedEvent
.getReplicationStatusChanged
in interface Space
public SpaceStatisticsChangedEventManager getStatisticsChanged()
Space
SpaceStatisticsChangedEvent
.
Note, statistics monitoring must be started using StatisticsMonitor.startStatisticsMonitor()
in
order to receive events.
getStatisticsChanged
in interface Space
public SpaceInstanceStatisticsChangedEventManager getInstanceStatisticsChanged()
Space
SpaceInstanceStatisticsChangedEvent
s.
Note, statistics monitoring must be started using StatisticsMonitor.startStatisticsMonitor()
in
order to receive events.
getInstanceStatisticsChanged
in interface Space
public SpaceStatistics getStatistics()
Space
getStatistics
in interface Space
public SpaceStatistics getPrimariesStatistics()
Space
getPrimariesStatistics
in interface Space
public SpaceStatistics getBackupsStatistics()
Space
getBackupsStatistics
in interface Space
public SpaceRuntimeDetails getRuntimeDetails()
Space
getRuntimeDetails
in interface Space
public SpaceReplicationManager getReplicationManager()
Space
getReplicationManager
in interface Space
public void addInstance(SpaceInstance spaceInstance)
addInstance
in interface InternalSpace
public InternalSpaceInstance removeInstance(String uid)
removeInstance
in interface InternalSpace
public void refreshScheduledSpaceMonitors()
refreshScheduledSpaceMonitors
in interface InternalSpace
public int getSize()
Space
public boolean isEmpty()
Space
true
if there are currently no space instances discovered.public IJSpace getIJSpace()
public GigaSpace getGigaSpace()
Space
getGigaSpace
in interface Space
public boolean waitFor(int numberOfSpaceInstances)
Space
public boolean waitFor(int numberOfSpaceInstances, long timeout, TimeUnit timeUnit)
Space
public boolean waitFor(int numberOfSpaceInstances, SpaceMode spaceMode)
Space
public boolean waitFor(int numberOfSpaceInstances, SpaceMode spaceMode, long timeout, TimeUnit timeUnit)
Space
public SpaceInstance[] getSpaceInstances()
getSpaceInstances
in interface InternalSpaceInstancesAware
public SpaceInstanceAddedEventManager getSpaceInstanceAdded()
Space
SpaceInstanceAddedEventListener
to be notified when space instances are added.getSpaceInstanceAdded
in interface Space
public SpaceInstanceRemovedEventManager getSpaceInstanceRemoved()
Space
SpaceInstanceRemovedEventListener
to be notified when space instances are removed.getSpaceInstanceRemoved
in interface Space
public void addLifecycleListener(SpaceInstanceLifecycleEventListener eventListener)
Space
SpaceInstanceLifecycleEventListener
.addLifecycleListener
in interface Space
public void removeLifecycleListener(SpaceInstanceLifecycleEventListener eventListener)
Space
SpaceInstanceLifecycleEventListener
.removeLifecycleListener
in interface Space
public Admin getAdmin()
getAdmin
in interface InternalSpace
public SpaceInstance getSpaceInstanceByUid(String uid)
InternalSpace
GridComponent.getUid()
)getSpaceInstanceByUid
in interface InternalSpace
uid
- the unique id of the Space instanceCopyright © GigaSpaces.