Class ReplicationStartupManager
java.lang.Object
com.j_spaces.core.cluster.startup.ReplicationStartupManager
- All Implemented Interfaces:
SpaceConnectionListener
ReplicationStartupManager handles the space startup state in persistent replicated cluster. Space
startup state is needed to keep track of the last space in cluster that was up, since it holds
the most updated cluster state. The ReplicationStartupManager monitors all the target spaces in
cluster. Initial spaces state is updated at space startup in
SpaceImpl. Connection events
are received from the AbstractReplicationChannel and disconnect events from GigaSpacesFaultDetectionHandler.
Default ReplicationStartupManager implementation stores space state to file. This behavior can be
changed by overriding the saveState and loadState methods.- Since:
- 5.1
- Version:
- 1.0
- Author:
- anna
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ReplicationStartupManager.StartupStateprotected final Stringprotected Filestatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidChange space state and store itprotected ReplicationStartupManager.StartupStatevoidCalled when one of the spaces in cluster connects to this spacevoidCalled when given space disconnectsprotected voidSave space statebooleanshouldWait(List<String> targetNames) Check if this space should wait for other space in cluster to startvoidWait for the last space to start
-
Field Details
-
DIR_NAME
- See Also:
-
FILENAME_SUFFIX
- See Also:
-
_spaceName
-
_currentSpaceState
-
_stateFile
-
-
Constructor Details
-
ReplicationStartupManager
- Parameters:
spaceName-
-
-
Method Details
-
getSpaceState
- Returns:
- space startup state
-
changeState
Change space state and store it -
loadState
- Returns:
- Loaded space state
- Throws:
IOException
-
saveState
Save space state- Throws:
IOException
-
waitForLastSpace
Wait for the last space to start- Throws:
InterruptedException
-
shouldWait
Check if this space should wait for other space in cluster to start- Throws:
InterruptedException
-
onSpaceConnect
Called when one of the spaces in cluster connects to this space- Specified by:
onSpaceConnectin interfaceSpaceConnectionListener- Parameters:
event- connection event
-
onSpaceDisconnect
Description copied from interface:SpaceConnectionListenerCalled when given space disconnects- Specified by:
onSpaceDisconnectin interfaceSpaceConnectionListener- Parameters:
event- contains the disconnected space
-