public class ReplicationStartupManager extends Object implements SpaceConnectionListener
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.| Modifier and Type | Class and Description |
|---|---|
static class |
ReplicationStartupManager.StartupState |
| Modifier and Type | Field and Description |
|---|---|
protected ReplicationStartupManager.StartupState |
_currentSpaceState |
protected String |
_spaceName |
protected File |
_stateFile |
static String |
DIR_NAME |
static String |
FILENAME_SUFFIX |
| Constructor and Description |
|---|
ReplicationStartupManager(String spaceName) |
| Modifier and Type | Method and Description |
|---|---|
void |
changeState(ReplicationStartupManager.StartupState newState)
Change space state and store it
|
ReplicationStartupManager.StartupState |
getSpaceState() |
protected ReplicationStartupManager.StartupState |
loadState() |
void |
onSpaceConnect(SpaceConnectionEvent event)
Called when one of the spaces in cluster connects to this space
|
void |
onSpaceDisconnect(SpaceConnectionEvent event)
Called when given space disconnects
|
protected void |
saveState(ReplicationStartupManager.StartupState state)
Save space state
|
boolean |
shouldWait(List<String> targetNames)
Check if this space should wait for other space in cluster to start
|
void |
waitForLastSpace()
Wait for the last space to start
|
public static final String DIR_NAME
public static final String FILENAME_SUFFIX
protected final String _spaceName
protected ReplicationStartupManager.StartupState _currentSpaceState
protected File _stateFile
public ReplicationStartupManager(String spaceName)
spaceName - public ReplicationStartupManager.StartupState getSpaceState()
public void changeState(ReplicationStartupManager.StartupState newState)
protected ReplicationStartupManager.StartupState loadState() throws IOException
IOExceptionprotected void saveState(ReplicationStartupManager.StartupState state) throws IOException
IOExceptionpublic void waitForLastSpace()
throws InterruptedException
InterruptedExceptionpublic boolean shouldWait(List<String> targetNames) throws InterruptedException
InterruptedExceptionpublic void onSpaceConnect(SpaceConnectionEvent event)
onSpaceConnect in interface SpaceConnectionListenerevent - connection eventpublic void onSpaceDisconnect(SpaceConnectionEvent event)
SpaceConnectionListeneronSpaceDisconnect in interface SpaceConnectionListenerevent - contains the disconnected spaceCopyright © GigaSpaces.