public abstract class ConnectionBasedDomainManager extends AbstractDomainManager
DomainManager
that must connect to an external source before being able to participate in a leadership
election.Modifier | Constructor and Description |
---|---|
protected |
ConnectionBasedDomainManager(String domain)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
connect()
Implementations must connect via this method.
|
protected abstract void |
disconnect()
Implementations must disconnect via this method.
|
protected void |
failedToConnect(Throwable exception)
Implementations can optionally override this if they need special handling for a failure to connect.
|
boolean |
isConnected()
Checks if this domain manager is connected.
|
protected 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 void |
onLastDeregister()
Implementations must handle any specific logic for dealing with a deregistration that empties the map of handlers
(such as disconnecting).
|
String |
toString() |
becomeActive, becomeStandby, deregister, getCurrentRole, getDomain, getRoleChangeHandlers, isAnythingRegistered, isRegistered, register
protected ConnectionBasedDomainManager(String domain)
domain
- the domain to managepublic boolean isConnected()
protected void failedToConnect(Throwable exception)
exception
- the exception that caused the failure the connectprotected abstract void connect()
This is executed in a separate thread so timeliness is not a factor. It is possible that multiple calls to connect() block waiting for the first one to finish so implementations of this method must be written to guard against this being a problem.
protected abstract void disconnect()
This is executed in a separate thread so timeliness is not a factor. It is possible that multiple calls to disconnect() block waiting for the first one to finish so implementations of this method must be written to guard against this being a problem.
protected final void onFirstRegister()
AbstractDomainManager
onFirstRegister
in class AbstractDomainManager
protected final void onLastDeregister()
AbstractDomainManager
onLastDeregister
in class AbstractDomainManager
public String toString()
toString
in class AbstractDomainManager
Copyright © 2021. All rights reserved.