Class LusBasedSelectorHandler
java.lang.Object
com.gigaspaces.cluster.activeelection.LeaderSelectorHandler
com.gigaspaces.cluster.activeelection.LusBasedSelectorHandler
- All Implemented Interfaces:
IActiveElectionListener,LeaderSelector
public class LusBasedSelectorHandler
extends LeaderSelectorHandler
implements IActiveElectionListener
Provides runtime primary/backup selection in cluster topologies.
- Since:
- 6.0
- Version:
- 1.0
- Author:
- Igor Goldenberg
-
Field Summary
Fields inherited from class com.gigaspaces.cluster.activeelection.LeaderSelectorHandler
_lastError, _logger, _primarySpaceModeListeners, _space, _spaceMember, _spaceMode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidForcefully make this space to be primaryvoidbooleanvoidonActive(ActiveElectionEvent theEvent) Notification about new elected Active service.voidonExtraBackup(ActiveElectionEvent theEvent) Notification that an extra-backup was resolved.voidonSplitBrain(ActiveElectionEvent theEvent) Notification about split-brain.voidonSplitBrainActive(ActiveElectionEvent theEvent) Notification that split-brain was resolved - current service remains primary.voidonSplitBrainBackup(ActiveElectionEvent theEvent) Notification about a backup that it's primary has changed due to split-brain.voidselect()start the primary election managervoidsetLastError(Throwable lastError) voidterminate the PrimarySpaceSelectorMethods inherited from class com.gigaspaces.cluster.activeelection.LeaderSelectorHandler
addListenerAndNotify, afterSpaceModeChange, beforeSpaceModeChange, compareAndRegister, dispatchBeforeEventToRemoteListeners, getSpaceMode, moveToBackup, moveToPrimary, moveToUnusable, removeListener, setSpaceMode
-
Constructor Details
-
LusBasedSelectorHandler
-
-
Method Details
-
initialize
- Overrides:
initializein classLeaderSelectorHandler- Throws:
Exception
-
isPrimary
public boolean isPrimary()- Specified by:
isPrimaryin interfaceLeaderSelector- Overrides:
isPrimaryin classLeaderSelectorHandler- Returns:
trueif the Space is primary, otherwise the space in backup mode.
-
getPrimaryMemberName
- Specified by:
getPrimaryMemberNamein interfaceLeaderSelector- Returns:
- the reference to the primary space
-
select
start the primary election manager- Specified by:
selectin interfaceLeaderSelector- Throws:
RemoteException
-
onActive
Description copied from interface:IActiveElectionListenerNotification about new elected Active service.- Specified by:
onActivein interfaceIActiveElectionListener- Parameters:
theEvent- The election event with an Active service reference.- See Also:
-
onSplitBrain
Description copied from interface:IActiveElectionListenerNotification about split-brain. Identified more then 1 ACTIVE services. This method will be called only after the split-brain was resolved.- Specified by:
onSplitBrainin interfaceIActiveElectionListener- Parameters:
theEvent- the active service (the new primary)- See Also:
-
onSplitBrainActive
Description copied from interface:IActiveElectionListenerNotification that split-brain was resolved - current service remains primary.- Specified by:
onSplitBrainActivein interfaceIActiveElectionListener- Parameters:
theEvent- the active service (same as the current elected)
-
onExtraBackup
Description copied from interface:IActiveElectionListenerNotification that an extra-backup was resolved. This method will be called on backup Spaces that should terminate.- Specified by:
onExtraBackupin interfaceIActiveElectionListener- Parameters:
theEvent- the active service used as reference for resolution
-
onSplitBrainBackup
Description copied from interface:IActiveElectionListenerNotification about a backup that it's primary has changed due to split-brain.- Specified by:
onSplitBrainBackupin interfaceIActiveElectionListener- Parameters:
theEvent- the active service (the new primary)
-
terminate
public void terminate()terminate the PrimarySpaceSelector- Specified by:
terminatein interfaceLeaderSelector
-
forceMoveToPrimary
Forcefully make this space to be primary- Overrides:
forceMoveToPrimaryin classLeaderSelectorHandler- Throws:
RemoteException
-
getLastError
- Specified by:
getLastErrorin interfaceLeaderSelector- Overrides:
getLastErrorin classLeaderSelectorHandler
-
setLastError
- Specified by:
setLastErrorin interfaceLeaderSelector- Overrides:
setLastErrorin classLeaderSelectorHandler
-