GigaSpaces XAP 7.0 API

org.openspaces.admin.space
Interface Space

All Superinterfaces:
Iterable<SpaceInstance>, StatisticsMonitor

public interface Space
extends Iterable<SpaceInstance>, StatisticsMonitor

A space is composed of several SpaceInstances the form a topology.

There are two main logical of topologies, one that has backups to each space instance, and one that is without backups. For example, a partitioned topology of 2 partitions, each with one backup will return 2 for getNumberOfInstances() and 1 for getNumberOfBackups(). A replicated topology of 4 will return 4 for getNumberOfInstances() and 0 for getNumberOfBackups().

A Space will be discovered once one of its SpaceInstance have been discovered. It will be removed once there are no SpaceInstances running.

Provides the ability to start a statistics monitor on all current SpaceInstances using StatisticsMonitor.startStatisticsMonitor(). Newly discovered space instances will automatically use the statistics monitor as well.

Author:
kimchy

Field Summary
 
Fields inherited from interface org.openspaces.admin.StatisticsMonitor
DEFAULT_HISTORY_SIZE, DEFAULT_MONITOR_INTERVAL
 
Method Summary
 void addLifecycleListener(SpaceInstanceLifecycleEventListener eventListener)
          Allows to add SpaceInstanceLifecycleEventListener.
 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.
 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 SpaceInstanceStatisticsChangedEvents.
 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.
 ReplicationStatusChangedEventManager getReplicationStatusChanged()
          Allows to globally register for each SpaceInstance ReplicationStatusChangedEvent.
 int getSize()
          Returns the number of currently discovered space instances.
 SpaceInstanceAddedEventManager getSpaceInstanceAdded()
          Allows to registered SpaceInstanceAddedEventListener to be notified when space instances are added.
 SpaceInstanceRemovedEventManager getSpaceInstanceRemoved()
          Allows to registered SpaceInstanceRemovedEventListener to be notified when space instances are removed.
 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.
 void removeLifecycleListener(SpaceInstanceLifecycleEventListener eventListener)
          Allows to remove SpaceInstanceLifecycleEventListener.
 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, com.gigaspaces.cluster.activeelection.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, com.gigaspaces.cluster.activeelection.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.
 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from interface org.openspaces.admin.StatisticsMonitor
isMonitoring, setStatisticsHistorySize, setStatisticsInterval, startStatisticsMonitor, stopStatisticsMontior
 

Method Detail

getSpaces

Spaces getSpaces()
Returns the spaces this space is one of.


getUid

String getUid()
Returns the uid of the Space.


getName

String getName()
Returns the name of the Space.


getNumberOfInstances

int getNumberOfInstances()
Returns the number of instances as per the Space topology. Will return 4 if we have a replicated topology, and 2 if we have a 2 partitions each with one backup topology.


getNumberOfBackups

int getNumberOfBackups()
Returns the number of backups per Space Instance. Returns 1 when we deploy a 2 partitions each with one backup topology.


getTotalNumberOfInstances

int getTotalNumberOfInstances()
Returns the total number of instances. If there are no backups, will return getNumberOfInstances(). If there are backups, will return getNumberOfInstances() * (getNumberOfBackups() + 1)


getInstances

SpaceInstance[] getInstances()
Returns all the space instances that are currently discovered that are part of this Space topology.


getPartitions

SpacePartition[] getPartitions()
Returns all the partitions that form this Space topology.


getPartition

SpacePartition getPartition(int partitionId)
Returns a partition for a specific partition id.


getSize

int getSize()
Returns the number of currently discovered space instances.


isEmpty

boolean isEmpty()
Returns true if there are currently no space instances discovered.


getGigaSpace

GigaSpace getGigaSpace()
Returns the clustered view of the space to operate on.


waitFor

boolean waitFor(int numberOfSpaceInstances)
Waits till at least the provided number of Space Instances are up.


waitFor

boolean waitFor(int numberOfSpaceInstances,
                long timeout,
                TimeUnit timeUnit)
Waits till at least the provided number of Space Instances are up for the specified timeout.


waitFor

boolean waitFor(int numberOfSpaceInstances,
                com.gigaspaces.cluster.activeelection.SpaceMode spaceMode)
Waits till at least the provided number of Space Instances that are of the space mode type are up.


waitFor

boolean waitFor(int numberOfSpaceInstances,
                com.gigaspaces.cluster.activeelection.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.


getStatistics

SpaceStatistics getStatistics()
Returns an aggregated view of all the statistics of all the instances.


getPrimariesStatistics

SpaceStatistics getPrimariesStatistics()
Returns an aggregated view of all the statistics of the primary instances.


getBackupsStatistics

SpaceStatistics getBackupsStatistics()
Returns an aggregated view of all the statistics of the backup instances.


getSpaceInstanceAdded

SpaceInstanceAddedEventManager getSpaceInstanceAdded()
Allows to registered SpaceInstanceAddedEventListener to be notified when space instances are added.


getSpaceInstanceRemoved

SpaceInstanceRemovedEventManager getSpaceInstanceRemoved()
Allows to registered SpaceInstanceRemovedEventListener to be notified when space instances are removed.


addLifecycleListener

void addLifecycleListener(SpaceInstanceLifecycleEventListener eventListener)
Allows to add SpaceInstanceLifecycleEventListener.


removeLifecycleListener

void removeLifecycleListener(SpaceInstanceLifecycleEventListener eventListener)
Allows to remove SpaceInstanceLifecycleEventListener.


getSpaceModeChanged

SpaceModeChangedEventManager getSpaceModeChanged()
Allows to globally regsiter for each SpaceInstance SpaceModeChangedEvent.


getReplicationStatusChanged

ReplicationStatusChangedEventManager getReplicationStatusChanged()
Allows to globally register for each SpaceInstance ReplicationStatusChangedEvent.


getStatisticsChanged

SpaceStatisticsChangedEventManager getStatisticsChanged()
Allows to register for aggregated Space level statistics SpaceStatisticsChangedEvent.

Note, statistics monitoring must be started using StatisticsMonitor.startStatisticsMonitor() in order to receive events.


getInstanceStatisticsChanged

SpaceInstanceStatisticsChangedEventManager getInstanceStatisticsChanged()
Allows to register for space instance level statistics SpaceInstanceStatisticsChangedEvents.

Note, statistics monitoring must be started using StatisticsMonitor.startStatisticsMonitor() in order to receive events.


GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.