@Deprecated public class ClusterNode extends AuthenticatedInjectedService implements ClusterService, ClusterDbPoller, ClusterCommPoller
Use this class instead of AristaFlowPlatform for
bootstrapping in a cluster environment.
This class handles all cluster stuff automatically, that is, if the server is not available any
more or there are any problems reaching the server, the cluster node restarts. In case of
problems it also may restart or even terminate in case of unrecoverable problems. However, this
requires to run asynchronously, so bootstrap(), restart(long) and
terminate() return early. You will have to check the status via
ClusterNodeState.getStatus() or ClusterNodeState.awaitStatus(long, Status...) to
make sure that the cluster is in the appropriate state.
Nevertheless, make sure that you terminate() the cluster node (and
await Status.TERMINATED) to
properly terminate the platform! Otherwise your JVM may not exit properly or not exit at all.
| Modifier and Type | Field and Description |
|---|---|
protected de.aristaflow.adept2.core.registry.cluster.ServerData |
commServer
Deprecated.
Data related to the current server like URIs and the amount of lost
connections.
|
protected java.util.concurrent.locks.Lock |
controlLock
Deprecated.
The lock required to control this cluster node.
|
protected ClusterNodeInformation |
dbServer
Deprecated.
Data related to the current server as retrieved from the database.
|
protected HeartBeatControl |
heartBeatControl
Deprecated.
The control for the heartbeats of this cluster node.
|
protected de.aristaflow.adept2.core.registry.cluster.NodeControl |
nodeControl
Deprecated.
The thread controlling this node, that is it handles the complete node
lifecycle including restarting and thus changing roles.
|
protected ClusterNodeState |
nodeState
Deprecated.
The state of this cluster node encapsulated in a separate object.
|
protected Registry |
registry
Deprecated.
The registry used to access the communication service of the cluster
server.
|
adept2Service, loggerClass, NOT_INITIALISED_EXCEPTIONEMPTY_STRING_ARRAY, logger, runtimeRequiredServices, startupRequiredServices| Constructor and Description |
|---|
ClusterNode(Configuration serverConf,
Configuration clientConf,
java.util.logging.Logger logger)
Deprecated.
Creates a new
ClusterNode having the designated
configurations. |
ClusterNode(Configuration serverConf,
ConfigurationPropertyProvider serverProvider,
Configuration clientConf,
ConfigurationPropertyProvider clientProvider,
java.util.logging.Logger logger)
Deprecated.
Creates a new
ClusterNode having the designated configurations
and the designated configuration providers. |
ClusterNode(ConfigurationPropertyProvider serverProvider,
ConfigurationPropertyProvider clientProvider,
java.util.logging.Logger logger)
Deprecated.
Creates a new
ClusterNode having the designated configuration
providers. |
| Modifier and Type | Method and Description |
|---|---|
void |
bootstrap()
Deprecated.
Bootstraps this cluster node asynchronously.
|
SimpleClusterNodeInformation |
doubtfulStatus(SessionToken session,
java.lang.String requestingNode,
long lastRequesterUpdate,
long lastServerUpdate,
long serverRunningSince)
Deprecated.
Gets information on the cluster node implementing this cluster service and
signals this cluster node, that its status is doubtful.
|
java.util.Set<ClusterNodeInformation> |
getAllClusterNodes()
Deprecated.
Retrieves the set of all known Cluster Nodes (dead or alive).
|
ClientService |
getClientService(long timeout)
Deprecated.
Gets the client service providing convenient access to the services
provided by the platform and needed by client components.
|
SimpleClusterNodeInformation |
getNodeInformation(SessionToken session)
Deprecated.
Gets information on the cluster node implementing this cluster service.
|
Registry |
getRegistry(long timeout)
Deprecated.
Gets the wrapper for accessing the platform via the
Registry
-interface waiting for the designated amount of time if the platform is
currently not available. |
Configuration |
getRootConfiguration(long timeout)
Deprecated.
Gets the root configuration used for this cluster node as clone waiting for
the designated amount of time if the platform is currently not available.
|
java.net.URI[] |
getServerCommService()
Deprecated.
Gets the URIs of the cluster service of the server for inter node
communication.
|
ClusterNodeState |
getState()
Deprecated.
Gets the node state of this cluster node.
|
void |
init(java.net.URI[] localExportedUris,
java.net.URI[] globalExportedUris)
Deprecated.
Checks the licence for failover cluster and starts
the heartbeat using the communication. |
void |
initPlatform(Configuration conf,
Registry reg)
Deprecated.
Creates a wrapped
AbstractAuthenticatedService. |
void |
pollServerComm(long timeout,
boolean serverDoubtful)
Deprecated.
Polls the server of this cluster via communication.
|
boolean |
pollServerDb(long timeout,
ClusterInteractionRequest request)
Deprecated.
Polls the server of this cluster and sends an alive signal to the cluster DB service.
|
Status |
restart(long timeout)
Deprecated.
Sends a restart request to this cluster node and waits the designated time for the restart.
|
void |
restartInternal()
Deprecated.
Signals a restart of this cluster node.
|
void |
shutdown(boolean emergency)
Deprecated.
Signals this service that it is being shut down.
|
void |
terminate()
Deprecated.
Sends a terminate request to this cluster node.
|
createChildSession, createSession, getAgent, getServiceInstanceName, getSessionFactory, getTopLevelAgent, getUserCredentials, sessionHasCapability_sessionActive, _sessionFinished, changeLogContext, changeLogContext, changeLogContext, csvLoggingEnabled, getClassSpecificJulLogger, getLogger, getRelease, isActive, isInitialised, logMethodEntry, logMethodEntry, logMethodEntry, logMethodExit, logMethodExit, privilegeThread, revertLogContextChanges, sessionActive, sessionActive, sessionActive, sessionFinished, signalShutdown, signalStart, start, unprivilegeThreadgetLocalUris, getRuntimeRequiredServices, getStartupRequiredServices, getURIs, ping, preShutdownclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLocalUris, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, ping, preShutdown, startprotected ClusterNodeInformation dbServer
null until a server is retrieved from the database.
Afterwards this information refers to the last server retrieved from the
database. This data may be stale.protected final de.aristaflow.adept2.core.registry.cluster.ServerData commServer
protected final ClusterNodeState nodeState
protected final HeartBeatControl heartBeatControl
protected final de.aristaflow.adept2.core.registry.cluster.NodeControl nodeControl
protected final java.util.concurrent.locks.Lock controlLock
protected Registry registry
public ClusterNode(Configuration serverConf, Configuration clientConf, java.util.logging.Logger logger)
ClusterNode having the designated
configurations.serverConf - The configuration to be provided when booted as server.
This may either be a complete root configuration (without
additional configuration directories), a delta configuration
complementing or overriding the configurations from the
configuration directories or even null. If this is
null, only configurations from the configuration
directories will be used but this requires a valid
rootConfFileName.clientConf - The configuration to be provided when booted as client.
This may either be a complete root configuration (without
additional configuration directories), a delta configuration
complementing or overriding the configurations from the
configuration directories or even null. If this is
null, only configurations from the configuration
directories will be used but this requires a valid
rootConfFileName. logger - The logger which to use for information that is happening
asynchronously that is critical or worth knowing. This has to be
configured separately since it is used outside of the platform
lifecycle.AristaFlowPlatform.AristaFlowPlatform(Configuration)public ClusterNode(ConfigurationPropertyProvider serverProvider, ConfigurationPropertyProvider clientProvider, java.util.logging.Logger logger)
ClusterNode having the designated configuration
providers.serverProvider - The configuration provider to be used when booted as
server. This can be null and it can be the same as
the clientProvider.clientProvider - The configuration provider to be used when booted as
client. This can be null and it can be the same as
the serverProvider.logger - The logger which to use for information that is happening
asynchronously that is critical or worth knowing. This has to be
configured separately since it is used outside of the platform
lifecycle.AristaFlowPlatform.AristaFlowPlatform(ConfigurationPropertyProvider)public ClusterNode(Configuration serverConf, ConfigurationPropertyProvider serverProvider, Configuration clientConf, ConfigurationPropertyProvider clientProvider, java.util.logging.Logger logger)
ClusterNode having the designated configurations
and the designated configuration providers.serverConf - The configuration to be provided when booted as server.
This may either be a complete root configuration (without
additional configuration directories), a delta configuration
complementing or overriding the configurations from the
configuration directories or even null. If this is
null, only configurations from the configuration
directories will be used but this requires a valid
rootConfFileName.serverProvider - The configuration provider to be used when booted as
server. This can be null and it can be the same as
the clientProvider.clientConf - The configuration to be provided when booted as client.
This may either be a complete root configuration (without
additional configuration directories), a delta configuration
complementing or overriding the configurations from the
configuration directories or even null. If this is
null, only configurations from the configuration
directories will be used but this requires a valid
rootConfFileName. clientProvider - The configuration provider to be used when booted as
client. This can be null and it can be the same as
the serverProvider.logger - The logger which to use for information that is happening
asynchronously that is critical or worth knowing. This has to be
configured separately since it is used outside of the platform
lifecycle.AristaFlowPlatform.AristaFlowPlatform(Configuration)public void bootstrap()
Only one platform may be running at a time. You need to terminate a platform before you can bootstrap another one. Note that terminating is done asynchronously so you need to wait for this cluster node to be terminated.
java.lang.IllegalThreadStateException - If this cluster node has already been bootstrapped, an
IllegalThreadStateException will be thrown.public ClientService getClientService(long timeout) throws AbortServiceException, java.lang.InterruptedException
timeout - The time in milliseconds to wait for the platform if it is
not available.java.lang.InterruptedException - If the current thread is interrupted while
waiting for the platform to become available, an
InterruptedException will be thrown.ServiceNotKnownException - If there are problems retrieving the
client service, a ServiceNotKnownException will be
thrown.AbortServiceException - If the platform has not been bootstrapped or
terminated or a non-recoverable problem has occurred, an
AbortServiceException will be thrown.public Registry getRegistry(long timeout) throws AbortServiceException, java.lang.InterruptedException
Registry
-interface waiting for the designated amount of time if the platform is
currently not available. The registry is used by (server) services to
access the registry. Clients should always use an appropriate
client service. Only use this registry for
very special purposes.timeout - The time in milliseconds to wait for the platform if it is
not available.null if the timeout elapsed before the platform
becomes available.java.lang.InterruptedException - If the current thread is interrupted while
waiting for the platform to become available, an
InterruptedException will be thrown.ServiceNotKnownException - If there are problems loading the model
factory registry, a ServiceNotKnownException will be
thrown.AbortServiceException - If the platform has not been bootstrapped or
terminated or a non-recoverable problem has occurred, an
AbortServiceException will be thrown.public Configuration getRootConfiguration(long timeout) throws AbortServiceException, java.lang.InterruptedException
timeout - The time in milliseconds to wait for the platform if it is
not available.null after terminating.java.lang.InterruptedException - If the current thread is interrupted while
waiting for the platform to become available, an
InterruptedException will be thrown.ServiceNotKnownException - If there are problems loading the model
factory registry, a ServiceNotKnownException will be
thrown.AbortServiceException - If the platform has not been bootstrapped or
terminated or a non-recoverable problem has occurred, an
AbortServiceException will be thrown.public Status restart(long timeout) throws java.lang.InterruptedException, AbortServiceException
timeout - The time in milliseconds to wait for the cluster node to be restarted or
terminated. reach one of the designated statuses. Use 0 to not wait at all or a
negative value to wait without time limit.Status.RUNNING_SERVER,
Status.CONNECTED_CLIENT or Status.TERMINATED) or null in
case the time elapsed before the status is reached.java.lang.InterruptedException - If the current thread is interrupted while waiting for the
restart, an InterruptedException will be thrown.AbortServiceException - If there are non-recoverable problems with the cluster especially
when bootstrapping, an AbortServiceException will be thrown.public void terminate()
Status.TERMINATED before really shutting down or exiting the JVM.
Terminating the platform several times will be ignored. The same applies to terminating before loading.
public java.util.Set<ClusterNodeInformation> getAllClusterNodes()
null in case no
cluster DB is available.public boolean pollServerDb(long timeout,
ClusterInteractionRequest request)
throws java.lang.InterruptedException,
java.util.concurrent.TimeoutException,
java.sql.SQLException
ClusterDbPollerIf the control of the cluster node cannot be acquired in the designated time, this method will do nothing.
pollServerDb in interface ClusterDbPollertimeout - The time in milliseconds to wait for the cluster control lock.request - Whether to simply poll or to restart the server. A restart request contains the
cluster name, the node name as well as the time since when the server has been
running. If this is null, the current server will just be polled.java.lang.InterruptedException - If the calling thread is interrupted while waiting for the node
control or has been interrupted before, an InterruptedException will be
thrown.java.util.concurrent.TimeoutException - If the table for updating the status cannot be locked in time, a
TimeoutException will be thrown.java.sql.SQLException - If there are problems updating the status in the cluster table, an
SQLException will be thrown.public void restartInternal()
ClusterDbPollerClusterDbPoller.pollServerDb(long, ClusterInteractionRequest)) or polling fails too often.restartInternal in interface ClusterDbPollerpublic java.net.URI[] getServerCommService()
ClusterCommPollergetServerCommService in interface ClusterCommPollernull if no global registry URIs are
set.public void pollServerComm(long timeout,
boolean serverDoubtful)
throws java.lang.InterruptedException
ClusterCommPollerIf the control of the cluster node cannot be acquired in the designated time, this method will do nothing.
pollServerComm in interface ClusterCommPollertimeout - The time in milliseconds to wait for the cluster control
lock.serverDoubtful - Whether the server is doubtful and should be notified
appropriately.java.lang.InterruptedException - If the calling thread is interrupted while
waiting for the node control or has been interrupted before, an
InterruptedException will be thrown.public ClusterNodeState getState()
public void initPlatform(Configuration conf, Registry reg) throws AbortServiceException
AuthenticatedInjectedServiceAbstractAuthenticatedService.initPlatform in class AuthenticatedInjectedServiceconf - The configuration provided by the platform.reg - The registry allowing to access the platform.AbortServiceException - If there are problems initialising this
service, an AbortServiceException will be thrown.public void init(java.net.URI[] localExportedUris,
java.net.URI[] globalExportedUris)
throws AbortServiceException
Checks the licence for failover cluster and starts
the heartbeat using the communication.init in interface ADEPT2Serviceinit in class InitialisedInjectedServicelocalExportedUris - The URIs with which this service is exported
locally or a local URI or an empty array for internal services.globalExportedUris - The URIs with which this service is published
globally or null in case the service is not
published.AbortServiceException - If this service cannot be initialised due to
a severe problem, an AbortServiceException will be
thrown. ADEPT2Service.shutdown(boolean) will not be called when aborting; the
service has to shut down itself/clean up before throwing the
exception.InjectedADEPT2Service.init(URI[], URI[]),
AbstractADEPT2Service.init(URI[], URI[])public void shutdown(boolean emergency)
ADEPT2ServiceServiceThreadHandling. shutdown in interface ADEPT2Serviceshutdown in class InitialisedInjectedServiceemergency - Whether the shutdown will be an emergency shutdown.InjectedADEPT2Service.start(),
AbstractADEPT2Service.start()public SimpleClusterNodeInformation getNodeInformation(SessionToken session)
ClusterServicegetNodeInformation in interface ClusterServicesession - The session which is used to check for access rights on this
method.public SimpleClusterNodeInformation doubtfulStatus(SessionToken session, java.lang.String requestingNode, long lastRequesterUpdate, long lastServerUpdate, long serverRunningSince)
ClusterServicedoubtfulStatus in interface ClusterServicesession - The session which is used to check for access rights on this
method.requestingNode - The name of the node notifying the doubtful status.lastRequesterUpdate - The last time the requester has updated its
status (which is the same as checking for the server status.lastServerUpdate - The last time the server has updated its status in
the database according to the requester. If this is older than the
last update time of the server, the requester has not the latest
status, thus the notified doubtful status is not valid (any more).serverRunningSince - The time the server has switched to running in
the database according to the requester. If this is older than the
current running since time, the requester has not the latest
status, thus the notified doubtful status is not valid (any more).