public abstract class LeaderSelectorHandler extends Object implements LeaderSelector
Modifier and Type | Field and Description |
---|---|
protected Throwable |
_lastError |
protected org.slf4j.Logger |
_logger |
protected PrimarySpaceModeListeners |
_primarySpaceModeListeners |
protected SpaceImpl |
_space |
protected String |
_spaceMember |
protected SpaceMode |
_spaceMode |
Constructor and Description |
---|
LeaderSelectorHandler() |
Modifier and Type | Method and Description |
---|---|
void |
addListenerAndNotify(ISpaceModeListener listener)
Add listener for space availability and notify the listener with the current space mode
|
protected void |
afterSpaceModeChange(SpaceMode newMode)
Notify the listeners about the event
|
protected void |
beforeSpaceModeChange(SpaceMode newMode)
Notify the listeners about the event
|
boolean |
compareAndRegister(SpaceMode spaceMode,
ISpaceModeListener listener)
Checks if space mode equals given mode.
|
protected void |
dispatchBeforeEventToRemoteListeners(Queue<ISpaceModeListener> remoteListeners,
SpaceMode newMode) |
void |
forceMoveToPrimary() |
Throwable |
getLastError() |
SpaceMode |
getSpaceMode() |
void |
initialize(LeaderSelectorHandlerConfig config) |
boolean |
isPrimary() |
protected void |
moveToBackup()
Change space mode to backup
|
protected void |
moveToPrimary()
Change space mode to primary
|
protected void |
moveToUnusable()
Change space state to UNHEALTHY, so it is redeployed
|
void |
removeListener(ISpaceModeListener listener)
Remove listener for space availability
|
void |
setLastError(Throwable lastError) |
void |
setSpaceMode(SpaceMode spaceMode) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPrimaryMemberName, select, terminate
protected org.slf4j.Logger _logger
protected String _spaceMember
protected SpaceImpl _space
protected PrimarySpaceModeListeners _primarySpaceModeListeners
protected volatile SpaceMode _spaceMode
protected volatile Throwable _lastError
public void initialize(LeaderSelectorHandlerConfig config) throws Exception
Exception
public boolean isPrimary()
isPrimary
in interface LeaderSelector
true
if the Space is primary, otherwise the space in backup mode.protected void beforeSpaceModeChange(SpaceMode newMode)
protected void afterSpaceModeChange(SpaceMode newMode)
protected void dispatchBeforeEventToRemoteListeners(Queue<ISpaceModeListener> remoteListeners, SpaceMode newMode)
protected void moveToPrimary()
protected void moveToBackup()
protected void moveToUnusable()
public void addListenerAndNotify(ISpaceModeListener listener) throws RemoteException
RemoteException
public void removeListener(ISpaceModeListener listener)
public void setSpaceMode(SpaceMode spaceMode)
public SpaceMode getSpaceMode()
public boolean compareAndRegister(SpaceMode spaceMode, ISpaceModeListener listener)
public Throwable getLastError()
getLastError
in interface LeaderSelector
public void setLastError(Throwable lastError)
setLastError
in interface LeaderSelector
public void forceMoveToPrimary() throws RemoteException
RemoteException
Copyright © GigaSpaces.