public static final class ClusteredServiceContainer.Context extends Object implements Cloneable
ClusteredServiceAgent after a successful
ClusteredServiceContainer.launch(Context) and closed via ClusteredServiceContainer.close().| Constructor and Description |
|---|
Context() |
| Modifier and Type | Method and Description |
|---|---|
Aeron |
aeron()
An
Aeron client for the container. |
ClusteredServiceContainer.Context |
aeron(Aeron aeron)
Provide an
Aeron client for the container |
String |
aeronDirectoryName()
Get the top level Aeron directory used for communication between the Aeron client and Media Driver.
|
ClusteredServiceContainer.Context |
aeronDirectoryName(String aeronDirectoryName)
Set the top level Aeron directory used for communication between the Aeron client and Media Driver.
|
int |
appVersion()
User assigned application version which appended to the log as the appVersion in new leadership events.
|
ClusteredServiceContainer.Context |
appVersion(int appVersion)
User assigned application version which appended to the log as the appVersion in new leadership events.
|
AppVersionValidator |
appVersionValidator()
User assigned application version validator implementation used to check version compatibility.
|
ClusteredServiceContainer.Context |
appVersionValidator(AppVersionValidator appVersionValidator)
User assigned application version validator implementation used to check version compatibility.
|
AeronArchive.Context |
archiveContext()
Get the context that should be used for communicating with the local Archive.
|
ClusteredServiceContainer.Context |
archiveContext(AeronArchive.Context archiveContext)
Set the context that should be used for communicating with the local Archive.
|
ClusteredServiceContainer.Context |
clone()
Perform a shallow copy of the object.
|
void |
close()
Close the context and free applicable resources.
|
File |
clusterDir()
The directory used for the cluster directory.
|
ClusteredServiceContainer.Context |
clusterDir(File clusterDir)
Set the directory to use for the cluster directory.
|
String |
clusterDirectoryName()
The directory name to use for the cluster directory.
|
ClusteredServiceContainer.Context |
clusterDirectoryName(String clusterDirectoryName)
Set the directory name to use for the consensus module directory.
|
ClusteredService |
clusteredService()
The service this container holds.
|
ClusteredServiceContainer.Context |
clusteredService(ClusteredService clusteredService)
Set the service this container is to hold.
|
int |
clusterId()
Get the id for this cluster instance.
|
ClusteredServiceContainer.Context |
clusterId(int clusterId)
Set the id for this cluster instance.
|
ClusterMarkFile |
clusterMarkFile()
The
ClusterMarkFile in use. |
ClusteredServiceContainer.Context |
clusterMarkFile(ClusterMarkFile markFile)
Set the
ClusterMarkFile in use. |
void |
conclude()
Conclude configuration by setting up defaults when specifics are not provided.
|
int |
consensusModuleStreamId()
Get the stream id for communications from the services to the consensus module.
|
ClusteredServiceContainer.Context |
consensusModuleStreamId(int streamId)
Set the stream id for communications from the services to the consensus module.
|
String |
controlChannel()
Get the channel parameter for bidirectional communications between the consensus module and services.
|
ClusteredServiceContainer.Context |
controlChannel(String channel)
Set the channel parameter for bidirectional communications between the consensus module and services.
|
CountedErrorHandler |
countedErrorHandler()
The
errorHandler() that will increment errorCounter() by default. |
ClusteredServiceContainer.Context |
countedErrorHandler(CountedErrorHandler countedErrorHandler)
Non-default for context.
|
long |
cycleThresholdNs()
Threshold for the container work cycle time which when exceed it will increment the
counter.
|
ClusteredServiceContainer.Context |
cycleThresholdNs(long thresholdNs)
Set a threshold for the container work cycle time which when exceed it will increment the
counter.
|
DelegatingErrorHandler |
delegatingErrorHandler()
Get the
DelegatingErrorHandler to be used by the ClusteredServiceContainer which will
delegate to errorHandler() as next in the chain. |
ClusteredServiceContainer.Context |
delegatingErrorHandler(DelegatingErrorHandler delegatingErrorHandler)
Set the
DelegatingErrorHandler to be used by the ClusteredServiceContainer which will
delegate to errorHandler() as next in the chain. |
void |
deleteDirectory()
Delete the cluster container directory.
|
DutyCycleTracker |
dutyCycleTracker()
The duty cycle tracker used to track the container duty cycle.
|
ClusteredServiceContainer.Context |
dutyCycleTracker(DutyCycleTracker dutyCycleTracker)
Set a duty cycle tracker to be used for tracking the duty cycle time of the container.
|
EpochClock |
epochClock()
Get the
EpochClock to used for tracking wall clock time within the container. |
ClusteredServiceContainer.Context |
epochClock(EpochClock clock)
Set the
EpochClock to be used for tracking wall clock time when interacting with the container. |
int |
errorBufferLength()
The error buffer length in bytes.
|
ClusteredServiceContainer.Context |
errorBufferLength(int errorBufferLength)
Set the error buffer length in bytes to use.
|
AtomicCounter |
errorCounter()
Get the error counter that will record the number of errors the container has observed.
|
ClusteredServiceContainer.Context |
errorCounter(AtomicCounter errorCounter)
Set the error counter that will record the number of errors the cluster node has observed.
|
ErrorHandler |
errorHandler()
Get the
ErrorHandler to be used by the ClusteredServiceContainer. |
ClusteredServiceContainer.Context |
errorHandler(ErrorHandler errorHandler)
Set the
ErrorHandler to be used by the ClusteredServiceContainer. |
DistinctErrorLog |
errorLog()
The
DistinctErrorLog in use. |
ClusteredServiceContainer.Context |
errorLog(DistinctErrorLog errorLog)
Set the
DistinctErrorLog in use. |
IdleStrategy |
idleStrategy()
Get a new
IdleStrategy based on configured supplier. |
ClusteredServiceContainer.Context |
idleStrategySupplier(Supplier<IdleStrategy> idleStrategySupplier)
Provides an
IdleStrategy supplier for the idle strategy for the agent duty cycle. |
boolean |
isRespondingService()
Is this a service that responds to client requests?
|
ClusteredServiceContainer.Context |
isRespondingService(boolean isRespondingService)
Set if this a service that responds to client requests.
|
int |
logFragmentLimit()
Get the fragment limit to be used when polling the log
Subscription. |
ClusteredServiceContainer.Context |
logFragmentLimit(int logFragmentLimit)
Set the fragment limit to be used when polling the log
Subscription. |
File |
markFileDir()
Get the directory in which the ClusteredServiceContainer will store mark file (i.e.
|
ClusteredServiceContainer.Context |
markFileDir(File markFileDir)
Set the directory in which the ClusteredServiceContainer will store mark file (i.e.
|
NanoClock |
nanoClock()
The
NanoClock as a source of time in nanoseconds for measuring duration. |
ClusteredServiceContainer.Context |
nanoClock(NanoClock clock)
The
NanoClock as a source of time in nanoseconds for measuring duration. |
boolean |
ownsAeronClient()
Does this context own the
aeron() client and this takes responsibility for closing it? |
ClusteredServiceContainer.Context |
ownsAeronClient(boolean ownsAeronClient)
Does this context own the
aeron() client and this takes responsibility for closing it? |
String |
replayChannel()
Get the channel parameter for the cluster log and snapshot replay channel.
|
ClusteredServiceContainer.Context |
replayChannel(String channel)
Set the channel parameter for the cluster log and snapshot replay channel.
|
int |
replayStreamId()
Get the stream id for the cluster log and snapshot replay channel.
|
ClusteredServiceContainer.Context |
replayStreamId(int streamId)
Set the stream id for the cluster log and snapshot replay channel.
|
int |
serviceId()
Get the id for this clustered service.
|
ClusteredServiceContainer.Context |
serviceId(int serviceId)
Set the id for this clustered service.
|
String |
serviceName()
Get the name for a clustered service to be the
Agent.roleName() for the Agent. |
ClusteredServiceContainer.Context |
serviceName(String serviceName)
Set the name for a clustered service to be the
Agent.roleName() for the Agent. |
int |
serviceStreamId()
Get the stream id for communications from the consensus module and to the services.
|
ClusteredServiceContainer.Context |
serviceStreamId(int streamId)
Set the stream id for communications from the consensus module and to the services.
|
ShutdownSignalBarrier |
shutdownSignalBarrier()
Get the
ShutdownSignalBarrier that can be used to shut down a clustered service. |
ClusteredServiceContainer.Context |
shutdownSignalBarrier(ShutdownSignalBarrier barrier)
Set the
ShutdownSignalBarrier that can be used to shut down a clustered service. |
String |
snapshotChannel()
Get the channel parameter for snapshot recordings.
|
ClusteredServiceContainer.Context |
snapshotChannel(String channel)
Set the channel parameter for snapshot recordings.
|
int |
snapshotStreamId()
Get the stream id for snapshot recordings.
|
ClusteredServiceContainer.Context |
snapshotStreamId(int streamId)
Set the stream id for snapshot recordings.
|
boolean |
standbySnapshotEnabled()
Indicates if this node should take standby snapshots
|
ClusteredServiceContainer.Context |
standbySnapshotEnabled(boolean standbySnapshotEnabled)
Indicates if this node should take standby snapshots
|
Runnable |
terminationHook()
Get the
Runnable that is called when container is instructed to terminate. |
ClusteredServiceContainer.Context |
terminationHook(Runnable terminationHook)
Set the
Runnable that is called when container is instructed to terminate. |
ThreadFactory |
threadFactory()
Get the thread factory used for creating threads.
|
ClusteredServiceContainer.Context |
threadFactory(ThreadFactory threadFactory)
Set the thread factory used for creating threads.
|
String |
toString() |
public ClusteredServiceContainer.Context clone()
public void conclude()
public ClusteredServiceContainer.Context appVersion(int appVersion)
This can be validated using SemanticVersion to ensure only application nodes of the same
major version communicate with each other.
appVersion - for user application.public int appVersion()
This can be validated using SemanticVersion to ensure only application nodes of the same
major version communicate with each other.
public ClusteredServiceContainer.Context appVersionValidator(AppVersionValidator appVersionValidator)
The default validator uses SemanticVersion semantics.
appVersionValidator - for user application.public AppVersionValidator appVersionValidator()
The default is to use SemanticVersion major version for checking compatibility.
public ClusteredServiceContainer.Context clusterId(int clusterId)
clusterId - for this clustered instance.ClusteredServiceContainer.Configuration.CLUSTER_ID_PROP_NAMEpublic int clusterId()
ClusteredServiceContainer.Configuration.CLUSTER_ID_PROP_NAMEpublic ClusteredServiceContainer.Context serviceId(int serviceId)
serviceId - for this clustered service.ClusteredServiceContainer.Configuration.SERVICE_ID_PROP_NAMEpublic int serviceId()
ClusteredServiceContainer.Configuration.SERVICE_ID_PROP_NAMEpublic ClusteredServiceContainer.Context serviceName(String serviceName)
Agent.roleName() for the Agent.serviceName - for a clustered service to be the role for the Agent.ClusteredServiceContainer.Configuration.SERVICE_NAME_PROP_NAMEpublic String serviceName()
Agent.roleName() for the Agent.Agent.ClusteredServiceContainer.Configuration.SERVICE_NAME_PROP_NAMEpublic ClusteredServiceContainer.Context replayChannel(String channel)
channel - parameter for the cluster log replay channel.ClusteredServiceContainer.Configuration.REPLAY_CHANNEL_PROP_NAMEpublic String replayChannel()
ClusteredServiceContainer.Configuration.REPLAY_CHANNEL_PROP_NAMEpublic ClusteredServiceContainer.Context replayStreamId(int streamId)
streamId - for the cluster log replay channel.ClusteredServiceContainer.Configuration.REPLAY_STREAM_ID_PROP_NAMEpublic int replayStreamId()
ClusteredServiceContainer.Configuration.REPLAY_STREAM_ID_PROP_NAMEpublic ClusteredServiceContainer.Context controlChannel(String channel)
channel - parameter for sending messages to the Consensus Module.ClusteredServiceContainer.Configuration.CONTROL_CHANNEL_PROP_NAMEpublic String controlChannel()
ClusteredServiceContainer.Configuration.CONTROL_CHANNEL_PROP_NAMEpublic ClusteredServiceContainer.Context serviceStreamId(int streamId)
streamId - for communications from the consensus module and to the services.ClusteredServiceContainer.Configuration.SERVICE_STREAM_ID_PROP_NAMEpublic int serviceStreamId()
ClusteredServiceContainer.Configuration.SERVICE_STREAM_ID_PROP_NAMEpublic ClusteredServiceContainer.Context consensusModuleStreamId(int streamId)
streamId - for communications from the services to the consensus module.ClusteredServiceContainer.Configuration.CONSENSUS_MODULE_STREAM_ID_PROP_NAMEpublic int consensusModuleStreamId()
ClusteredServiceContainer.Configuration.CONSENSUS_MODULE_STREAM_ID_PROP_NAMEpublic ClusteredServiceContainer.Context snapshotChannel(String channel)
channel - parameter for snapshot recordingsClusteredServiceContainer.Configuration.SNAPSHOT_CHANNEL_PROP_NAMEpublic String snapshotChannel()
ClusteredServiceContainer.Configuration.SNAPSHOT_CHANNEL_PROP_NAMEpublic ClusteredServiceContainer.Context snapshotStreamId(int streamId)
streamId - for snapshot recordings.ClusteredServiceContainer.Configuration.SNAPSHOT_STREAM_ID_PROP_NAMEpublic int snapshotStreamId()
ClusteredServiceContainer.Configuration.SNAPSHOT_STREAM_ID_PROP_NAMEpublic ClusteredServiceContainer.Context isRespondingService(boolean isRespondingService)
isRespondingService - true if this service responds to client requests, otherwise false.ClusteredServiceContainer.Configuration.RESPONDER_SERVICE_PROP_NAMEpublic ClusteredServiceContainer.Context logFragmentLimit(int logFragmentLimit)
Subscription.logFragmentLimit - for this clustered service.ClusteredServiceContainer.Configuration.LOG_FRAGMENT_LIMIT_DEFAULTpublic int logFragmentLimit()
Subscription.Subscription.ClusteredServiceContainer.Configuration.LOG_FRAGMENT_LIMIT_PROP_NAMEpublic boolean isRespondingService()
ClusteredServiceContainer.Configuration.RESPONDER_SERVICE_PROP_NAMEpublic ThreadFactory threadFactory()
public ClusteredServiceContainer.Context threadFactory(ThreadFactory threadFactory)
threadFactory - used for creating threadspublic ClusteredServiceContainer.Context idleStrategySupplier(Supplier<IdleStrategy> idleStrategySupplier)
IdleStrategy supplier for the idle strategy for the agent duty cycle.idleStrategySupplier - supplier for the idle strategy for the agent duty cycle.public IdleStrategy idleStrategy()
IdleStrategy based on configured supplier.IdleStrategy based on configured supplier.public ClusteredServiceContainer.Context epochClock(EpochClock clock)
EpochClock to be used for tracking wall clock time when interacting with the container.clock - EpochClock to be used for tracking wall clock time when interacting with the container.public EpochClock epochClock()
EpochClock to used for tracking wall clock time within the container.EpochClock to used for tracking wall clock time within the container.public ErrorHandler errorHandler()
ErrorHandler to be used by the ClusteredServiceContainer.ErrorHandler to be used by the ClusteredServiceContainer.public ClusteredServiceContainer.Context errorHandler(ErrorHandler errorHandler)
ErrorHandler to be used by the ClusteredServiceContainer.errorHandler - the error handler to be used by the ClusteredServiceContainer.public DelegatingErrorHandler delegatingErrorHandler()
DelegatingErrorHandler to be used by the ClusteredServiceContainer which will
delegate to errorHandler() as next in the chain.DelegatingErrorHandler to be used by the ClusteredServiceContainer.ClusteredServiceContainer.Configuration.DELEGATING_ERROR_HANDLER_PROP_NAMEpublic ClusteredServiceContainer.Context delegatingErrorHandler(DelegatingErrorHandler delegatingErrorHandler)
DelegatingErrorHandler to be used by the ClusteredServiceContainer which will
delegate to errorHandler() as next in the chain.delegatingErrorHandler - the error handler to be used by the ClusteredServiceContainer.ClusteredServiceContainer.Configuration.DELEGATING_ERROR_HANDLER_PROP_NAMEpublic AtomicCounter errorCounter()
public ClusteredServiceContainer.Context errorCounter(AtomicCounter errorCounter)
errorCounter - the error counter that will record the number of errors the cluster node has observed.public ClusteredServiceContainer.Context countedErrorHandler(CountedErrorHandler countedErrorHandler)
countedErrorHandler - to override the default.public CountedErrorHandler countedErrorHandler()
errorHandler() that will increment errorCounter() by default.errorHandler() that will increment errorCounter() by default.public ClusteredServiceContainer.Context aeronDirectoryName(String aeronDirectoryName)
aeronDirectoryName - the top level Aeron directory.public String aeronDirectoryName()
public Aeron aeron()
Aeron client for the container.Aeron client for the containerpublic ClusteredServiceContainer.Context aeron(Aeron aeron)
Aeron client for the container
If not provided then one will be created.
aeron - client for the containerpublic ClusteredServiceContainer.Context ownsAeronClient(boolean ownsAeronClient)
aeron() client and this takes responsibility for closing it?ownsAeronClient - does this context own the aeron() client.public boolean ownsAeronClient()
aeron() client and this takes responsibility for closing it?aeron() client and this takes responsibility for closing it?public ClusteredService clusteredService()
public ClusteredServiceContainer.Context clusteredService(ClusteredService clusteredService)
clusteredService - this container is to hold.public ClusteredServiceContainer.Context archiveContext(AeronArchive.Context archiveContext)
archiveContext - that should be used for communicating with the local Archive.public AeronArchive.Context archiveContext()
public ClusteredServiceContainer.Context clusterDirectoryName(String clusterDirectoryName)
clusterDirectoryName - to use.ClusteredServiceContainer.Configuration.CLUSTER_DIR_PROP_NAMEpublic String clusterDirectoryName()
ClusteredServiceContainer.Configuration.CLUSTER_DIR_PROP_NAMEpublic ClusteredServiceContainer.Context clusterDir(File clusterDir)
clusterDir - to use.ClusteredServiceContainer.Configuration.CLUSTER_DIR_PROP_NAMEpublic File clusterDir()
ClusteredServiceContainer.Configuration.CLUSTER_DIR_PROP_NAMEpublic File markFileDir()
cluster-mark-service-0.dat). It defaults to clusterDir() if it is not set explicitly via the ClusteredServiceContainer.Configuration.MARK_FILE_DIR_PROP_NAME.cluster-mark-service-0.dat).ClusteredServiceContainer.Configuration.MARK_FILE_DIR_PROP_NAME,
clusterDir()public ClusteredServiceContainer.Context markFileDir(File markFileDir)
cluster-mark-service-0.dat).markFileDir - the directory in which the ClusteredServiceContainer will store mark file (i.e. cluster-mark-service-0.dat).public ClusteredServiceContainer.Context shutdownSignalBarrier(ShutdownSignalBarrier barrier)
ShutdownSignalBarrier that can be used to shut down a clustered service.barrier - that can be used to shut down a clustered service.public ShutdownSignalBarrier shutdownSignalBarrier()
ShutdownSignalBarrier that can be used to shut down a clustered service.ShutdownSignalBarrier that can be used to shut down a clustered service.public ClusteredServiceContainer.Context terminationHook(Runnable terminationHook)
Runnable that is called when container is instructed to terminate.terminationHook - that can be used to terminate a service container.public Runnable terminationHook()
Runnable that is called when container is instructed to terminate.
The default action is to call signal on the shutdownSignalBarrier().
Runnable that can be used to terminate a service container.public ClusteredServiceContainer.Context clusterMarkFile(ClusterMarkFile markFile)
ClusterMarkFile in use.markFile - to use.public ClusterMarkFile clusterMarkFile()
ClusterMarkFile in use.ClusterMarkFile in use.public ClusteredServiceContainer.Context errorBufferLength(int errorBufferLength)
errorBufferLength - in bytes to use.public int errorBufferLength()
public ClusteredServiceContainer.Context errorLog(DistinctErrorLog errorLog)
DistinctErrorLog in use.errorLog - to use.public DistinctErrorLog errorLog()
DistinctErrorLog in use.DistinctErrorLog in use.public NanoClock nanoClock()
NanoClock as a source of time in nanoseconds for measuring duration.NanoClock as a source of time in nanoseconds for measuring duration.public ClusteredServiceContainer.Context nanoClock(NanoClock clock)
NanoClock as a source of time in nanoseconds for measuring duration.clock - to be used.public ClusteredServiceContainer.Context cycleThresholdNs(long thresholdNs)
thresholdNs - value in nanosecondsClusteredServiceContainer.Configuration.CYCLE_THRESHOLD_PROP_NAME,
ClusteredServiceContainer.Configuration.CYCLE_THRESHOLD_DEFAULT_NSpublic long cycleThresholdNs()
public ClusteredServiceContainer.Context dutyCycleTracker(DutyCycleTracker dutyCycleTracker)
dutyCycleTracker - to use for tracking.public DutyCycleTracker dutyCycleTracker()
public void deleteDirectory()
public boolean standbySnapshotEnabled()
true if this should take standby snapshots, false otherwise.ClusteredServiceContainer.Configuration.STANDBY_SNAPSHOT_ENABLED_PROP_NAME,
ClusteredServiceContainer.Configuration.standbySnapshotEnabled()public ClusteredServiceContainer.Context standbySnapshotEnabled(boolean standbySnapshotEnabled)
standbySnapshotEnabled - if this node should take standby snapshots.ClusteredServiceContainer.Configuration.STANDBY_SNAPSHOT_ENABLED_PROP_NAME,
ClusteredServiceContainer.Configuration.standbySnapshotEnabled()public void close()
If ownsAeronClient() is true then the aeron() client will be closed.
Copyright © 2014-2023 Real Logic Limited. All Rights Reserved.