public abstract class AbstractDomainManager extends Object implements DomainManager
DomainManager
.Modifier | Constructor and Description |
---|---|
protected |
AbstractDomainManager(String domain)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
becomeActive()
Executed when becoming ACTIVE for the managed domain.
|
protected void |
becomeStandby()
Executed when becoming STANDBY for the managed domain.
|
void |
deregister(String id)
Deregister with the domain being managed.
|
protected Role |
getCurrentRole() |
protected String |
getDomain() |
Map<String,RoleChangeHandler> |
getRoleChangeHandlers()
Check the current view of the registered change handlers.
|
boolean |
isAnythingRegistered()
Checks if anything is currently registered with the domain being managed.
|
boolean |
isRegistered(String id)
Checks if a given Id is registered.
|
protected abstract void |
onFirstRegister()
Implementations must handle any specific logic for dealing with a registration that adds to the map of handlers
for the first time (such as connecting).
|
protected abstract void |
onLastDeregister()
Implementations must handle any specific logic for dealing with a deregistration that empties the map of handlers
(such as disconnecting).
|
void |
register(String id,
RoleChangeHandler roleChangeHandler)
Register with the domain being managed.
|
String |
toString() |
protected AbstractDomainManager(String domain)
domain
- the domain to managepublic final Map<String,RoleChangeHandler> getRoleChangeHandlers()
protected final void becomeActive()
protected final void becomeStandby()
protected final Role getCurrentRole()
protected final String getDomain()
protected abstract void onFirstRegister()
protected abstract void onLastDeregister()
public final void register(String id, RoleChangeHandler roleChangeHandler)
DomainManager
Ids must be unique to this manager. Attempting to register the same Id twice will result in an exception.
The methods specified by the RoleChangeHandler
passed to this method must not block.
register
in interface DomainManager
id
- the Id to registerroleChangeHandler
- the role change handler to registerpublic final void deregister(String id)
DomainManager
deregister
in interface DomainManager
id
- the Id to registerpublic final boolean isRegistered(String id)
DomainManager
isRegistered
in interface DomainManager
id
- the Id to checkpublic final boolean isAnythingRegistered()
DomainManager
isAnythingRegistered
in interface DomainManager
Copyright © 2021. All rights reserved.