Package io.aeron
Class CommonContext
java.lang.Object
io.aeron.CommonContext
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
Aeron.Context,MediaDriver.Context
This class provides the Media Driver and client with common configuration for the Aeron directory.
This class should have conclude() called before the methods are used or at least
concludeAeronDirectory() to avoid NPEs.
Properties:
aeron.dir: Use value as directory name for Aeron buffers and status.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumCondition to specify a triple state conditional of always override to be true, always override to be false, or infer value. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe value of the top level Aeron directory unless overridden byaeronDirectoryName(String).static final StringThe top level Aeron directory used for communication between a Media Driver and client.static final StringParameter name for channel URI param to indicate an alias for the given URI.static final StringParameter name of the offset for the channel receive timestamp to be inserted into the incoming message on a subscription.static final StringParameter name of the offset for the channel send timestamp to be inserted into the outgoing message on a publication.static final StringParameter name for Subscription URI param to indicate the congestion control algorithm to be used.static final StringValid value forMDC_CONTROL_MODE_PARAM_NAMEwhen response control is desired.static final StringProperty name for the timeout to use in debug mode.static final longDefault timeout in which the driver is expected to respond or heartbeat.static final longTimeout in which the driver is expected to respond or heartbeat.static final StringProperty name for driver timeout after which the driver is considered inactive.static final StringShould new/experimental features be enabled.static final StringThe address and port used for a UDP channel.static final StringParameter name for channel URI param to indicate if End of Stream (EOS) should be sent or not.static final StringProperty name for a fallbackPrintStreambased logger when it is not possible to use the error logging callback.static final StringParameter name for Publication URI param to indicate the flow control strategy to be used.static final StringParameter name for channel URI param to indicate if a Subscription represents a group member or individual from the perspective of message reception.static final StringParameter name for Subscription URI param to indicate the receiver tag to be sent in SMs.static final StringInitial term id to be used when creating anExclusivePublication.static final StringThe network interface via which the socket will be routed.static final StringURI base used for IPC channels forPublications andSubscriptions.static final StringMedia type used for IPC shared memory fromPublicationtoSubscriptionchannels.static final StringKey for timeout a publication to linger after draining in nanoseconds.static final StringParameter name to set the max number of outstanding active retransmits for a publication.static final StringValid value forMDC_CONTROL_MODE_PARAM_NAMEwhen dynamic control is desired.static final StringValid value forMDC_CONTROL_MODE_PARAM_NAMEwhen manual control is desired.static final StringKey for the mode of control that such be used for multi-destination-cast semantics.static final StringThe param for the control channel IP address and port for multi-destination-cast semantics.static final StringParameter name of the offset for the media receive timestamp to be inserted into the incoming message on a subscription.static final StringMTU length parameter name for using as a channel URI param.static final StringParameter name to set explicit NAK delay (e.g.static final intValue to represent a sessionId that is not to be used.static final StringShould a component print its configuration on start toSystem.out.static final StringPlaceholder value to use in response channels where the publication is to be pre-created to reserve and hold onto the local port.static final StringParameter name for the publication window length, i.e.static final StringParameter name for the congestion control's initial receiver window length.static final StringParameter name for Subscription URI param to indicate if Images that go unavailable should be allowed to rejoin after a short cooldown or not.static final StringParameter name for channel URI param to indicate if a subscribed stream must be reliable or not.static final StringPlaceholder value to use in URIs to specify that a timestamp should be stored in the reserved value field.static final StringParameter name for the field that will be used to specify the correlation id used on a publication to connect it to a subscription's image in order to set up a response stream.static final StringParameter name for the field that will be used to specify the response endpoint on a subscription and publication used in a response "server".static final StringThe default secure random algorithm to be used.static final StringProperty name to use to set the secure random algorithm to be used by the Aeron component.static final StringKey for the session id for a publication or restricted subscription.static final StringParameter name for the underlying OS socket receive buffer length.static final StringParameter name for the underlying OS socket send buffer length.static final StringParameter name for channel URI param to indicate if term buffers should be sparse.static final StringParameter name for Publication URI param to indicate whether spy subscriptions should simulate a connection.static final StringURI used for SpySubscriptions whereby an outgoing unicast or multicast publication can be spied on by IPC without receiving it again via the network.static final StringParameter name to set the stream id for the channel.static final StringQualifier for a value which is a tag for reference.static final StringKey for the tags for a channel.static final StringCurrent term id to be used when creating anExclusivePublication.static final StringThe param name to be used for the term length as a channel URI param.static final StringCurrent term offset to be used when creating anExclusivePublication.static final StringParameter name for channel URI param to indicate if a subscription should tether for local flow control.static final StringTime To Live param for a multicast datagram.static final StringURI base used for UDP channels forPublications andSubscriptions.static final StringMedia type used for UDP sockets fromPublicationtoSubscriptionchannels.static final StringParameter name to set explicit untethered linger timeout, e.g.static final StringParameter name to set explicit untethered resting timeout, e.g.static final StringParameter name to set explicit untethered window limit timeout, e.g. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the directory in which the aeron config files are stored.Get the top level Aeron directory used for communication between the client and Media Driver, and the location of the data buffers.aeronDirectoryName(String dirName) Set the top level Aeron directory used for communication between the client and Media Driver, and the location of the data buffers.static longcheckDebugTimeout(long timeout, TimeUnit timeUnit) Override the supplied timeout with the debug value if it has been set, and we are in debug mode.static longcheckDebugTimeout(long timeout, TimeUnit timeUnit, double factor) Override the supplied timeout with the debug value if it has been set, and we are in debug mode.clone()Perform a shallow copy of the object.voidclose()Release resources used by the CommonContext.cncFile()Get the command and control file.conclude()This completes initialization of the CommonContext object.Conclude theaeronDirectory()so it does not need to keep being recreated.Get the buffer containing the counter metadata.countersMetaDataBuffer(UnsafeBuffer countersMetaDataBuffer) Set the buffer containing the counter metadata.Get the buffer containing the counters.countersValuesBuffer(UnsafeBuffer countersValuesBuffer) Set the buffer containing the counters.voidDelete the current Aeron directory, throwing errors if not possible.static intdriverFilePageSize(File aeronDirectory, EpochClock clock, long timeoutMs) Connect to the media driver and extract file page size from the C'n'C file.longGet the driver timeout in milliseconds.driverTimeoutMs(long driverTimeoutMs) Set the driver timeout in milliseconds.booleanShould experimental features for the driver be enabled.enableExperimentalFeatures(boolean enableExperimentalFeatures) Should experimental features for the driver be enabled.static AtomicBuffererrorLogBuffer(ByteBuffer cncByteBuffer) Get anAtomicBufferwhich wraps the error log in the CnC file.static PrintStreamGet the current fallback logger based on the supplied property.static StringConvert the default Aeron directory name to be a random name for use with embedded drivers.static StringGet the default directory name to be used ifaeronDirectoryName(String)is not set.static StringGet the configured value for the secure random algorithm, falling back to the default if not supplied.booleanHas the context had theconclude()method called.booleanisDriverActive(long driverTimeoutMs, Consumer<String> logger) Is a media driver active in the current Aeron directory?static booleanisDriverActive(long driverTimeoutMs, Consumer<String> logger, ByteBuffer cncByteBuffer) Is a media driver active in the current mapped CnC buffer? If the driver is starting then it will wait for up to the driverTimeoutMs by checking for the cncVersion being set.static booleanisDriverActive(File directory, long driverTimeoutMs, Consumer<String> logger) Is a media driver active in the given directory?mapExistingCncFile(Consumer<String> logger) Map the CnC file if it exists.static FilenewCncFile(String aeronDirectoryName) Create a new command and control file in the administration directory.static FileCreate a new command and control file in the administration directory.static longnextCorrelationId(File aeronDirectory, EpochClock clock, long timeoutMs) Connect to the media driver and get thenextCorrelationId.static intprintErrorLog(AtomicBuffer errorBuffer, PrintStream out) Print the contents of an error log to aPrintStreamin human-readable format.static booleanrequestDriverTermination(File directory, DirectBuffer tokenBuffer, int tokenOffset, int tokenLength) Request a driver to run its termination hook.intsaveErrorLog(PrintStream out) Read the error log to a givenPrintStream.intsaveErrorLog(PrintStream out, ByteBuffer cncByteBuffer) Read the error log to a givenPrintStream.static voidsaveExistingErrors(File markFile, AtomicBuffer errorBuffer, PrintStream logger, String errorFilePrefix) Save the existing errors from aMarkFileto a file in the same directory as the originalMarkFileand optionally print location of such file to the suppliedPrintStream.static ErrorHandlersetupErrorHandler(ErrorHandler userErrorHandler, DistinctErrorLog errorLog) Wrap a user ErrorHandler so that error will continue to write to the errorLog.static booleanShould a component's configuration be printed on start.
-
Field Details
-
PRINT_CONFIGURATION_ON_START_PROP_NAME
Should a component print its configuration on start toSystem.out.- See Also:
-
DRIVER_TIMEOUT_PROP_NAME
Property name for driver timeout after which the driver is considered inactive.- See Also:
-
DEBUG_TIMEOUT_PROP_NAME
Property name for the timeout to use in debug mode. By default, this is not set and the configured timeouts will be used. Setting this value adjusts timeouts to make debugging easier.- See Also:
-
DEFAULT_DRIVER_TIMEOUT_MS
public static final long DEFAULT_DRIVER_TIMEOUT_MSDefault timeout in which the driver is expected to respond or heartbeat.- See Also:
-
DRIVER_TIMEOUT_MS
public static final long DRIVER_TIMEOUT_MSTimeout in which the driver is expected to respond or heartbeat. -
NULL_SESSION_ID
public static final int NULL_SESSION_IDValue to represent a sessionId that is not to be used.- See Also:
-
AERON_DIR_PROP_NAME
The top level Aeron directory used for communication between a Media Driver and client.- See Also:
-
AERON_DIR_PROP_DEFAULT
The value of the top level Aeron directory unless overridden byaeronDirectoryName(String). -
ENABLE_EXPERIMENTAL_FEATURES_PROP_NAME
Should new/experimental features be enabled.- Since:
- 1.44.0
- See Also:
-
FALLBACK_LOGGER_PROP_NAME
Property name for a fallbackPrintStreambased logger when it is not possible to use the error logging callback. Supported values are stdout, stderr, no_op (stderr is the default).- See Also:
-
IPC_MEDIA
Media type used for IPC shared memory fromPublicationtoSubscriptionchannels.- See Also:
-
UDP_MEDIA
Media type used for UDP sockets fromPublicationtoSubscriptionchannels.- See Also:
-
IPC_CHANNEL
URI base used for IPC channels forPublications andSubscriptions.- See Also:
-
UDP_CHANNEL
URI base used for UDP channels forPublications andSubscriptions.- See Also:
-
SPY_PREFIX
URI used for SpySubscriptions whereby an outgoing unicast or multicast publication can be spied on by IPC without receiving it again via the network.- See Also:
-
ENDPOINT_PARAM_NAME
The address and port used for a UDP channel. For the publisher it is the socket to send to, for the subscriber it is the socket to receive from.- See Also:
-
INTERFACE_PARAM_NAME
The network interface via which the socket will be routed.- See Also:
-
INITIAL_TERM_ID_PARAM_NAME
Initial term id to be used when creating anExclusivePublication.- See Also:
-
TERM_ID_PARAM_NAME
Current term id to be used when creating anExclusivePublication.- See Also:
-
TERM_OFFSET_PARAM_NAME
Current term offset to be used when creating anExclusivePublication.- See Also:
-
TERM_LENGTH_PARAM_NAME
The param name to be used for the term length as a channel URI param.- See Also:
-
MTU_LENGTH_PARAM_NAME
MTU length parameter name for using as a channel URI param. If this is greater than the network MTU for UDP then the packet will be fragmented and can amplify the impact of loss.- See Also:
-
TTL_PARAM_NAME
Time To Live param for a multicast datagram.- See Also:
-
MDC_CONTROL_PARAM_NAME
The param for the control channel IP address and port for multi-destination-cast semantics.- See Also:
-
MDC_CONTROL_MODE_PARAM_NAME
Key for the mode of control that such be used for multi-destination-cast semantics.- See Also:
-
MDC_CONTROL_MODE_MANUAL
Valid value forMDC_CONTROL_MODE_PARAM_NAMEwhen manual control is desired.- See Also:
-
MDC_CONTROL_MODE_DYNAMIC
Valid value forMDC_CONTROL_MODE_PARAM_NAMEwhen dynamic control is desired. Default value.- See Also:
-
CONTROL_MODE_RESPONSE
Valid value forMDC_CONTROL_MODE_PARAM_NAMEwhen response control is desired.- See Also:
-
SESSION_ID_PARAM_NAME
Key for the session id for a publication or restricted subscription.- See Also:
-
LINGER_PARAM_NAME
Key for timeout a publication to linger after draining in nanoseconds.- See Also:
-
RELIABLE_STREAM_PARAM_NAME
Parameter name for channel URI param to indicate if a subscribed stream must be reliable or not. Value is boolean with true to recover loss and false to gap fill.- See Also:
-
TAGS_PARAM_NAME
Key for the tags for a channel.- See Also:
-
TAG_PREFIX
Qualifier for a value which is a tag for reference. This prefix is use in the param value.- See Also:
-
SPARSE_PARAM_NAME
Parameter name for channel URI param to indicate if term buffers should be sparse. Value is boolean.- See Also:
-
ALIAS_PARAM_NAME
Parameter name for channel URI param to indicate an alias for the given URI. Value not interpreted by Aeron.This is a reserved application level param used to identify a particular channel for application purposes.
- See Also:
-
EOS_PARAM_NAME
Parameter name for channel URI param to indicate if End of Stream (EOS) should be sent or not. Value is boolean.- See Also:
-
TETHER_PARAM_NAME
Parameter name for channel URI param to indicate if a subscription should tether for local flow control. Value is boolean. A tether only applies when there is more than one matching active subscription. If tether is true then that subscription is included in flow control. If only one subscription then it tethers pace.- See Also:
-
GROUP_PARAM_NAME
Parameter name for channel URI param to indicate if a Subscription represents a group member or individual from the perspective of message reception. This can inform loss handling and similar semantics.When configuring a subscription for an MDC publication then should be added as this is effective multicast.
-
REJOIN_PARAM_NAME
Parameter name for Subscription URI param to indicate if Images that go unavailable should be allowed to rejoin after a short cooldown or not.- See Also:
-
CONGESTION_CONTROL_PARAM_NAME
Parameter name for Subscription URI param to indicate the congestion control algorithm to be used. Options includestaticandcubic.- See Also:
-
FLOW_CONTROL_PARAM_NAME
Parameter name for Publication URI param to indicate the flow control strategy to be used. Options includemin,max, andpref.- See Also:
-
GROUP_TAG_PARAM_NAME
Parameter name for Subscription URI param to indicate the receiver tag to be sent in SMs.- See Also:
-
SPIES_SIMULATE_CONNECTION_PARAM_NAME
Parameter name for Publication URI param to indicate whether spy subscriptions should simulate a connection.- See Also:
-
SOCKET_SNDBUF_PARAM_NAME
Parameter name for the underlying OS socket send buffer length.- See Also:
-
SOCKET_RCVBUF_PARAM_NAME
Parameter name for the underlying OS socket receive buffer length.- See Also:
-
RECEIVER_WINDOW_LENGTH_PARAM_NAME
Parameter name for the congestion control's initial receiver window length.- See Also:
-
MEDIA_RCV_TIMESTAMP_OFFSET_PARAM_NAME
Parameter name of the offset for the media receive timestamp to be inserted into the incoming message on a subscription. The special value of 'reserved' can be used to insert into the reserved value field. Media receive timestamp is taken as the earliest possible point after the packet is received from the network. This is only supported in the C media driver, the Java Media Driver will generate an error if used.- See Also:
-
CHANNEL_RECEIVE_TIMESTAMP_OFFSET_PARAM_NAME
Parameter name of the offset for the channel receive timestamp to be inserted into the incoming message on a subscription. The special value of 'reserved' can be used to insert into the reserved value field. Channel receive timestamp is taken as soon a possible after the packet is received by Aeron receiver from the transport bindings.- See Also:
-
CHANNEL_SEND_TIMESTAMP_OFFSET_PARAM_NAME
Parameter name of the offset for the channel send timestamp to be inserted into the outgoing message on a publication. The special value of 'reserved' can be used to insert into the reserved value field. Channel send timestamp is taken shortly before passing the message over to the configured transport bindings.- See Also:
-
RESERVED_OFFSET
Placeholder value to use in URIs to specify that a timestamp should be stored in the reserved value field.- See Also:
-
RESPONSE_ENDPOINT_PARAM_NAME
Parameter name for the field that will be used to specify the response endpoint on a subscription and publication used in a response "server".- Since:
- 1.44.0
- See Also:
-
RESPONSE_CORRELATION_ID_PARAM_NAME
Parameter name for the field that will be used to specify the correlation id used on a publication to connect it to a subscription's image in order to set up a response stream.- Since:
- 1.44.0
- See Also:
-
PROTOTYPE_CORRELATION_ID
Placeholder value to use in response channels where the publication is to be pre-created to reserve and hold onto the local port.- See Also:
-
NAK_DELAY_PARAM_NAME
Parameter name to set explicit NAK delay (e.g.nak-delay=200ms).- Since:
- 1.44.0
- See Also:
-
UNTETHERED_WINDOW_LIMIT_TIMEOUT_PARAM_NAME
Parameter name to set explicit untethered window limit timeout, e.g.untethered-window-limit-timeout=10s.- Since:
- 1.45.0
- See Also:
-
UNTETHERED_LINGER_TIMEOUT_PARAM_NAME
Parameter name to set explicit untethered linger timeout, e.g.untethered-linger-timeout=10s.- Since:
- 1.48.0
- See Also:
-
UNTETHERED_RESTING_TIMEOUT_PARAM_NAME
Parameter name to set explicit untethered resting timeout, e.g.untethered-resting-timeout=10s.- Since:
- 1.45.0
- See Also:
-
MAX_RESEND_PARAM_NAME
Parameter name to set the max number of outstanding active retransmits for a publication.- Since:
- 1.45.0
- See Also:
-
STREAM_ID_PARAM_NAME
Parameter name to set the stream id for the channel.- Since:
- 1.47.0
- See Also:
-
PUBLICATION_WINDOW_LENGTH_PARAM_NAME
Parameter name for the publication window length, i.e. how far ahead can publication accept offers.- Since:
- 1.47.0
- See Also:
-
SECURE_RANDOM_ALGORITHM_PROP_NAME
Property name to use to set the secure random algorithm to be used by the Aeron component.- See Also:
-
SECURE_RANDOM_ALGORITHM_DEFAULT
The default secure random algorithm to be used.
-
-
Constructor Details
-
CommonContext
public CommonContext()
-
-
Method Details
-
shouldPrintConfigurationOnStart
public static boolean shouldPrintConfigurationOnStart()Should a component's configuration be printed on start.- Returns:
trueif the configuration should be printed on start.- See Also:
-
getSecureRandomAlgorithm
Get the configured value for the secure random algorithm, falling back to the default if not supplied.- Returns:
- the secure random algorithm
- See Also:
-
fallbackLogger
Get the current fallback logger based on the supplied property.- Returns:
- the configured PrintStream.
-
clone
Perform a shallow copy of the object. -
getAeronDirectoryName
Get the default directory name to be used ifaeronDirectoryName(String)is not set. This will take theAERON_DIR_PROP_NAMEif set and if not thenAERON_DIR_PROP_DEFAULT.- Returns:
- the default directory name to be used if
aeronDirectoryName(String)is not set.
-
generateRandomDirName
Convert the default Aeron directory name to be a random name for use with embedded drivers.- Returns:
- random directory name with default directory name as base
-
conclude
This completes initialization of the CommonContext object. It is automatically called by subclasses.- Returns:
- this Object for method chaining.
-
isConcluded
public boolean isConcluded()Has the context had theconclude()method called.- Returns:
- true of the
conclude()method has been called.
-
concludeAeronDirectory
Conclude theaeronDirectory()so it does not need to keep being recreated.- Returns:
- this for a fluent API.
-
aeronDirectoryName
Get the top level Aeron directory used for communication between the client and Media Driver, and the location of the data buffers.- Returns:
- The top level Aeron directory.
-
aeronDirectory
Get the directory in which the aeron config files are stored.This is valid after a call to
conclude()orconcludeAeronDirectory().- Returns:
- the directory in which the aeron config files are stored.
- See Also:
-
aeronDirectoryName
Set the top level Aeron directory used for communication between the client and Media Driver, and the location of the data buffers.- Parameters:
dirName- New top level Aeron directory.- Returns:
- this for a fluent API.
-
newDefaultCncFile
Create a new command and control file in the administration directory.- Returns:
- The newly created File.
-
newCncFile
Create a new command and control file in the administration directory.- Parameters:
aeronDirectoryName- name of the aeronDirectory that containing the cnc file.- Returns:
- The newly created File.
-
countersMetaDataBuffer
Get the buffer containing the counter metadata. These counters are R/W for the driver, read only for all other users.- Returns:
- The buffer storing the counter metadata.
-
countersMetaDataBuffer
Set the buffer containing the counter metadata. Testing/internal purposes only.- Parameters:
countersMetaDataBuffer- The new counter metadata buffer.- Returns:
- this for a fluent API.
-
countersValuesBuffer
Get the buffer containing the counters. These counters are R/W for the driver, read only for all other users.- Returns:
- The buffer storing the counters.
-
countersValuesBuffer
Set the buffer containing the counters. Testing/internal purposes only.- Parameters:
countersValuesBuffer- The new counters buffer.- Returns:
- this for a fluent API.
-
cncFile
Get the command and control file.- Returns:
- The command and control file.
-
driverTimeoutMs
Set the driver timeout in milliseconds.- Parameters:
driverTimeoutMs- to indicate liveness of driver- Returns:
- this for a fluent API.
-
driverTimeoutMs
public long driverTimeoutMs()Get the driver timeout in milliseconds.- Returns:
- driver timeout in milliseconds.
-
enableExperimentalFeatures
public boolean enableExperimentalFeatures()Should experimental features for the driver be enabled.- Returns:
trueif enabled,falseotherwise.- Since:
- 1.44.0
- See Also:
-
enableExperimentalFeatures
Should experimental features for the driver be enabled.- Parameters:
enableExperimentalFeatures- indicate whether experimental features for the driver should be enabled.- Returns:
- this for a fluent API
- Since:
- 1.44.0
- See Also:
-
checkDebugTimeout
Override the supplied timeout with the debug value if it has been set, and we are in debug mode.- Parameters:
timeout- The timeout value currently in use.timeUnit- The units of the timeout value. Debug timeout is specified in ns, so will be converted to this unit.- Returns:
- The debug timeout if specified, and we are being debugged or the supplied value if not. Will be in timeUnit units.
-
checkDebugTimeout
Override the supplied timeout with the debug value if it has been set, and we are in debug mode.- Parameters:
timeout- The timeout value currently in use.timeUnit- The units of the timeout value. Debug timeout is specified in ns, so will be converted to this unit.factor- to multiply the debug timeout by. Required when some timeouts need to be larger than others in order to pass validation. E.g. clientLiveness and publicationUnblock.- Returns:
- The debug timeout if specified, and we are being debugged or the supplied value if not. Will be in timeUnit units.
-
deleteAeronDirectory
public void deleteAeronDirectory()Delete the current Aeron directory, throwing errors if not possible. -
mapExistingCncFile
Map the CnC file if it exists.- Parameters:
logger- for feedback- Returns:
- a new mapping for the file if it exists otherwise null;
-
isDriverActive
Is a media driver active in the given directory?- Parameters:
directory- to check.driverTimeoutMs- for the driver liveness check.logger- for feedback as liveness checked.- Returns:
- true if a driver is active or false if not.
-
isDriverActive
Is a media driver active in the current Aeron directory?- Parameters:
driverTimeoutMs- for the driver liveness check.logger- for feedback as liveness checked.- Returns:
- true if a driver is active or false if not.
-
isDriverActive
public static boolean isDriverActive(long driverTimeoutMs, Consumer<String> logger, ByteBuffer cncByteBuffer) Is a media driver active in the current mapped CnC buffer? If the driver is starting then it will wait for up to the driverTimeoutMs by checking for the cncVersion being set.- Parameters:
driverTimeoutMs- for the driver liveness check.logger- for feedback as liveness checked.cncByteBuffer- for the existing CnC file.- Returns:
- true if a driver is active or false if not.
-
requestDriverTermination
public static boolean requestDriverTermination(File directory, DirectBuffer tokenBuffer, int tokenOffset, int tokenLength) Request a driver to run its termination hook.- Parameters:
directory- for the driver.tokenBuffer- containing the optional token for the request.tokenOffset- within the tokenBuffer at which the token begins.tokenLength- of the token in the tokenBuffer.- Returns:
- true if request was sent or false if request could not be sent.
-
saveErrorLog
Read the error log to a givenPrintStream.- Parameters:
out- to write the error log contents to.- Returns:
- the number of observations from the error log.
-
saveErrorLog
Read the error log to a givenPrintStream.- Parameters:
out- to write the error log contents to.cncByteBuffer- containing the error log.- Returns:
- the number of observations from the error log.
-
close
public void close()Release resources used by the CommonContext. -
printErrorLog
Print the contents of an error log to aPrintStreamin human-readable format.- Parameters:
errorBuffer- to read errors from.out- print the errors to.- Returns:
- number of distinct errors observed.
-
saveExistingErrors
public static void saveExistingErrors(File markFile, AtomicBuffer errorBuffer, PrintStream logger, String errorFilePrefix) Save the existing errors from aMarkFileto a file in the same directory as the originalMarkFileand optionally print location of such file to the suppliedPrintStream.- Parameters:
markFile- which contains the error buffer.errorBuffer- which wraps the error log.logger- to which the existing errors will be printed.errorFilePrefix- to add to the generated error file.
-
errorLogBuffer
Get anAtomicBufferwhich wraps the error log in the CnC file.- Parameters:
cncByteBuffer- which contains the error log.- Returns:
- an
AtomicBufferwhich wraps the error log in the CnC file.
-
setupErrorHandler
public static ErrorHandler setupErrorHandler(ErrorHandler userErrorHandler, DistinctErrorLog errorLog) Wrap a user ErrorHandler so that error will continue to write to the errorLog.- Parameters:
userErrorHandler- the user specified ErrorHandler, can be null.errorLog- the configured errorLog, either the default or user supplied.- Returns:
- an error handler that will delegate to both the userErrorHandler and the errorLog.
-
driverFilePageSize
Connect to the media driver and extract file page size from the C'n'C file.- Parameters:
aeronDirectory- where driver is running.clock- to use.timeoutMs- for awaiting connection.- Returns:
- file page size from running media driver or
LogBufferDescriptor.PAGE_MIN_SIZEif driver is old. - Since:
- 1.48.0
-
nextCorrelationId
Connect to the media driver and get thenextCorrelationId.- Parameters:
aeronDirectory- where driver is running.clock- to use.timeoutMs- for awaiting connection.- Returns:
- next correlation id.
- Since:
- 1.48.0
-