public class SpaceComponentManager extends Object implements ISpaceModeListener
Space states:
-------------------------------------------------------------
Space components types:
--------------------------------------------------------------
backup components - components that can run on backup spaces.
primary only - components
that can run only on primary spaces.
The following state transitions are handled:
--------------------------------------------------
NONE-->PRIMARY - space becomes primary
after the first election. All components are started.
NONE-->BACKUP - space becomes backup
after the first election. Only the backup components are started.
BACKUP-->PRIMARY - space becomes primary after previously being backup. Only the primary-only components are started, since backup components are already up.
PRIMARY-->BACKUP - in case of a "split-brain" where two spaces are primary at the same time, one of them returns to backup. In this case all the space components are restarted.
Constructor and Description |
---|
SpaceComponentManager(SpaceImpl space)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
afterMovingToBackup()
Called after space becomes backup.
|
void |
afterSpaceModeChange(SpaceMode newMode)
Called right after the space mode changes.
|
void |
beforeMovingToBackup()
Called before space becomes backup.
|
void |
beforeSpaceModeChange(SpaceMode newMode)
Called right before the space mode changes.
Implementors usually use it to allow specific service initializations. |
void |
clear() |
LinkedList<ISpaceComponentsHandler> |
getComponentsHandlers() |
SpaceImpl |
getSpace() |
SpaceMode |
getSpaceMode() |
void |
init()
Initialize the component manager with space components.
|
void |
initComponents()
Initialize all space components
|
void |
restartSpaceComponents()
Restart space components.
|
void |
setComponentsHandlers(LinkedList<ISpaceComponentsHandler> componentsHandlers) |
void |
setSpace(SpaceImpl space) |
void |
setSpaceMode(SpaceMode spaceMode) |
void |
startComponents()
Start all space components
|
public SpaceComponentManager(SpaceImpl space) throws SpaceComponentsInitializeException
public void init() throws SpaceComponentsInitializeException
public void beforeSpaceModeChange(SpaceMode newMode)
ISpaceModeListener
beforeSpaceModeChange
in interface ISpaceModeListener
newMode
- the new mode change before it's published.public void afterSpaceModeChange(SpaceMode newMode)
ISpaceModeListener
afterSpaceModeChange
in interface ISpaceModeListener
newMode
- the new mode change after it was published.public void afterMovingToBackup()
public void beforeMovingToBackup() throws SpaceComponentsInitializeException
public void initComponents() throws SpaceComponentsInitializeException
public void startComponents()
public void restartSpaceComponents() throws SpaceComponentsInitializeException
public LinkedList<ISpaceComponentsHandler> getComponentsHandlers()
public void setComponentsHandlers(LinkedList<ISpaceComponentsHandler> componentsHandlers)
componentsHandlers
- The componentsHandlers to set.public SpaceImpl getSpace()
public void setSpace(SpaceImpl space)
space
- The space to set.public SpaceMode getSpaceMode()
public void setSpaceMode(SpaceMode spaceMode)
spaceMode
- The spaceMode to set.public void clear()
Copyright © GigaSpaces.