public class DefaultSpaces extends Object implements InternalSpaces
DEFAULT_HISTORY_SIZE, DEFAULT_MONITOR_INTERVAL
Constructor and Description |
---|
DefaultSpaces(InternalAdmin admin) |
Modifier and Type | Method and Description |
---|---|
void |
addLifecycleListener(SpaceInstanceLifecycleEventListener eventListener)
Allows to add a
SpaceInstanceLifecycleEventListener
hthat will be called for any space instance discovered. |
void |
addLifecycleListener(SpaceLifecycleEventListener eventListener)
Adds a
SpaceLifecycleEventListener to be notified
when a Space is added and removed. |
void |
addSpace(Space space) |
void |
addSpaceInstance(SpaceInstance spaceInstance) |
Admin |
getAdmin()
Returns the
Admin associated with this element. |
Map<String,Space> |
getNames()
Returns a map of
Space s keyed by their names. |
ReplicationStatusChangedEventManager |
getReplicationStatusChanged()
Returns an event manager allowing to globally register for
ReplicationStatusChangedEvent s that happen on any Space
instance currently discovered. |
SpaceAddedEventManager |
getSpaceAdded()
Returns an event manager allowing to add
SpaceAddedEventListener s. |
Space |
getSpaceByName(String name)
Returns a space based on its name.
|
Space |
getSpaceByUID(String uid)
Returns a space based on its uid.
|
SpaceInstanceAddedEventManager |
getSpaceInstanceAdded()
Returns an event manager allowing to globally add
SpaceInstanceAddedEventListener
that will be called for any space instance discovered. |
SpaceInstanceRemovedEventManager |
getSpaceInstanceRemoved()
Returns an event manager allowing to globally remove
SpaceInstanceAddedEventListener
that will be called for any space instance discovered. |
SpaceInstance[] |
getSpaceInstances() |
SpaceInstanceStatisticsChangedEventManager |
getSpaceInstanceStatisticsChanged()
Returns an event manager allowing to register for
SpaceInstanceStatisticsChangedEvent s
that occur on all the currently discovered SpaceInstance s. |
SpaceModeChangedEventManager |
getSpaceModeChanged()
Returns an event manager allowing to globally register for
SpaceModeChangedEvent s that happen on any Space instance
currently discovered. |
SpaceRemovedEventManager |
getSpaceRemoved()
Returns an event manager allowing to remove
SpaceAddedEventListener s. |
Space[] |
getSpaces()
Returns all the currently discovered
Space s. |
SpaceStatisticsChangedEventManager |
getSpaceStatisticsChanged()
Returns an event manager allowing to register for
SpaceStatisticsChangedEvent s
that occur on all the currently discovered Space s. |
boolean |
isMonitoring()
Returns
true if statistics are now being monitored. |
Iterator<Space> |
iterator() |
void |
refreshScheduledSpaceMonitors() |
void |
removeLifecycleListener(SpaceInstanceLifecycleEventListener eventListener)
Allows to remove a
SpaceInstanceLifecycleEventListener
hthat will be called for any space instance discovered. |
void |
removeLifecycleListener(SpaceLifecycleEventListener eventListener)
Removes a
SpaceLifecycleEventListener to be
notified when a Space is added and removed. |
InternalSpace |
removeSpace(String uid) |
SpaceInstance |
removeSpaceInstance(String uid) |
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.
|
Space |
waitFor(String spaceName)
Waits indefinitely till the provided Space name is discovered.
|
Space |
waitFor(String spaceName,
long timeout,
TimeUnit timeUnit)
Waits for the given timeout (in time unit) till the space name is discovered.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public DefaultSpaces(InternalAdmin admin)
public Admin getAdmin()
AdminAware
Admin
associated with this element.getAdmin
in interface AdminAware
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 Space[] getSpaces()
Spaces
Space
s.public Space getSpaceByUID(String uid)
Spaces
getSpaceByUID
in interface Spaces
public Space getSpaceByName(String name)
Spaces
getSpaceByName
in interface Spaces
public Map<String,Space> getNames()
Spaces
Space
s keyed by their names.public SpaceAddedEventManager getSpaceAdded()
Spaces
SpaceAddedEventListener
s.getSpaceAdded
in interface Spaces
public SpaceRemovedEventManager getSpaceRemoved()
Spaces
SpaceAddedEventListener
s.getSpaceRemoved
in interface Spaces
public SpaceStatisticsChangedEventManager getSpaceStatisticsChanged()
Spaces
SpaceStatisticsChangedEvent
s
that occur on all the currently discovered Space
s.
Note, StatisticsMonitor.startStatisticsMonitor()
must be called in order to start monitor
statistics.
getSpaceStatisticsChanged
in interface Spaces
public SpaceInstanceStatisticsChangedEventManager getSpaceInstanceStatisticsChanged()
Spaces
SpaceInstanceStatisticsChangedEvent
s
that occur on all the currently discovered SpaceInstance
s.
Note, StatisticsMonitor.startStatisticsMonitor()
must be called in order to start monitoring
statistics.
getSpaceInstanceStatisticsChanged
in interface Spaces
public Space waitFor(String spaceName)
Spaces
public Space waitFor(String spaceName, long timeout, TimeUnit timeUnit)
Spaces
true
if the space is discovered, false
if the timeout expired.public void addLifecycleListener(SpaceLifecycleEventListener eventListener)
Spaces
SpaceLifecycleEventListener
to be notified
when a Space
is added and removed.addLifecycleListener
in interface Spaces
public void removeLifecycleListener(SpaceLifecycleEventListener eventListener)
Spaces
SpaceLifecycleEventListener
to be
notified when a Space
is added and removed.removeLifecycleListener
in interface Spaces
public SpaceModeChangedEventManager getSpaceModeChanged()
Spaces
SpaceModeChangedEvent
s that happen on any Space instance
currently discovered.getSpaceModeChanged
in interface Spaces
public ReplicationStatusChangedEventManager getReplicationStatusChanged()
Spaces
ReplicationStatusChangedEvent
s that happen on any Space
instance currently discovered.getReplicationStatusChanged
in interface Spaces
public SpaceInstance[] getSpaceInstances()
getSpaceInstances
in interface InternalSpaceInstancesAware
public SpaceInstanceAddedEventManager getSpaceInstanceAdded()
Spaces
SpaceInstanceAddedEventListener
that will be called for any space instance discovered.getSpaceInstanceAdded
in interface Spaces
public SpaceInstanceRemovedEventManager getSpaceInstanceRemoved()
Spaces
SpaceInstanceAddedEventListener
that will be called for any space instance discovered.getSpaceInstanceRemoved
in interface Spaces
public void addLifecycleListener(SpaceInstanceLifecycleEventListener eventListener)
Spaces
SpaceInstanceLifecycleEventListener
hthat will be called for any space instance discovered.addLifecycleListener
in interface Spaces
public void removeLifecycleListener(SpaceInstanceLifecycleEventListener eventListener)
Spaces
SpaceInstanceLifecycleEventListener
hthat will be called for any space instance discovered.removeLifecycleListener
in interface Spaces
public void addSpace(Space space)
addSpace
in interface InternalSpaces
public InternalSpace removeSpace(String uid)
removeSpace
in interface InternalSpaces
public void addSpaceInstance(SpaceInstance spaceInstance)
addSpaceInstance
in interface InternalSpaces
public SpaceInstance removeSpaceInstance(String uid)
removeSpaceInstance
in interface InternalSpaces
public void refreshScheduledSpaceMonitors()
refreshScheduledSpaceMonitors
in interface InternalSpaces
Copyright © GigaSpaces.