public class CommonContext
extends java.lang.Object
implements java.lang.AutoCloseable
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.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
AERON_DIR_PROP_DEFAULT
The value of the top level Aeron directory unless overridden by
aeronDirectoryName(String) |
static java.lang.String |
AERON_DIR_PROP_NAME
The top level Aeron directory used for communication between a Media Driver and client.
|
static long |
DEFAULT_DRIVER_TIMEOUT_MS
Timeout in which the driver is expected to respond.
|
static java.lang.String |
INITIAL_TERM_ID_PARAM_NAME
Initial term id to be used when creating an
ExclusivePublication. |
static java.lang.String |
IPC_CHANNEL
URI used for IPC
Publications and Subscriptions |
static java.lang.String |
MDC_CONTROL_MODE
Key for the mode of control that such be used for multi-destination-cast semantics.
|
static java.lang.String |
MDC_CONTROL_MODE_MANUAL
Valid value for
MDC_CONTROL_MODE when manual control is desired. |
static java.lang.String |
MTU_LENGTH_URI_PARAM_NAME
MTU length parameter name for using as a channel URI param.
|
static java.lang.String |
RELIABLE_STREAM_PARAM_NAME
Parameter name for channel URI param to indicate if a subscribed must be reliable or not.
|
static java.lang.String |
SPY_PREFIX
URI used for Spy
Subscriptions whereby an outgoing unicast or multicast publication can be spied on
by IPC without receiving it again via the network. |
static java.lang.String |
TERM_ID_PARAM_NAME
Current term id to be used when creating an
ExclusivePublication. |
static java.lang.String |
TERM_LENGTH_PARAM_NAME
The param name to be used for the term length as a channel URI param.
|
static java.lang.String |
TERM_OFFSET_PARAM_NAME
Current term offset to be used when creating an
ExclusivePublication. |
| Constructor and Description |
|---|
CommonContext()
Create a new context with Aeron directory and delete on exit values based on the current system properties.
|
| Modifier and Type | Method and Description |
|---|---|
java.io.File |
aeronDirectory()
Get the directory in which the aeron config files are stored.
|
java.lang.String |
aeronDirectoryName()
Get the top level Aeron directory used for communication between the client and Media Driver, and
the location of the data buffers.
|
CommonContext |
aeronDirectoryName(java.lang.String dirName)
Set the top level Aeron directory used for communication between the client and Media Driver, and the location
of the data buffers.
|
void |
close()
Release resources used by the CommonContext.
|
java.io.File |
cncFile()
Get the command and control file.
|
CommonContext |
conclude()
This completes initialization of the CommonContext object.
|
CommonContext |
concludeAeronDirectory()
Conclude the
aeronDirectory() so it does not need to keep being recreated. |
org.agrona.concurrent.UnsafeBuffer |
countersMetaDataBuffer()
Get the buffer containing the counter meta data.
|
CommonContext |
countersMetaDataBuffer(org.agrona.concurrent.UnsafeBuffer countersMetaDataBuffer)
Set the buffer containing the counter meta data.
|
org.agrona.concurrent.UnsafeBuffer |
countersValuesBuffer()
Get the buffer containing the counters.
|
CommonContext |
countersValuesBuffer(org.agrona.concurrent.UnsafeBuffer countersValuesBuffer)
Set the buffer containing the counters
|
void |
deleteAeronDirectory()
Delete the current Aeron directory, throwing errors if not possible.
|
long |
driverTimeoutMs()
Get the driver timeout in milliseconds.
|
CommonContext |
driverTimeoutMs(long driverTimeoutMs)
Set the driver timeout in milliseconds
|
static java.lang.String |
generateRandomDirName()
Convert the default Aeron directory name to be a random name for use with embedded drivers.
|
static boolean |
isDriverActive(java.io.File directory,
long driverTimeoutMs,
java.util.function.Consumer<java.lang.String> logProgress)
Is a media driver active in the given directory?
|
boolean |
isDriverActive(long driverTimeoutMs,
java.util.function.Consumer<java.lang.String> logHandler)
Is a media driver active in the current Aeron directory?
|
static boolean |
isDriverActive(long driverTimeoutMs,
java.util.function.Consumer<java.lang.String> logProgress,
java.nio.MappedByteBuffer cncByteBuffer)
Is a media driver active in the current mapped CnC buffer?
|
java.nio.MappedByteBuffer |
mapExistingCncFile(java.util.function.Consumer<java.lang.String> logProgress)
Map the CnC file if it exists.
|
static java.io.File |
newDefaultCncFile()
Create a new command and control file in the administration directory.
|
int |
saveErrorLog(java.io.PrintStream out)
Read the error log to a given
PrintStream |
int |
saveErrorLog(java.io.PrintStream out,
java.nio.MappedByteBuffer cncByteBuffer)
Read the error log to a given
PrintStream |
public static final java.lang.String AERON_DIR_PROP_NAME
public static final java.lang.String AERON_DIR_PROP_DEFAULT
aeronDirectoryName(String)public static final java.lang.String IPC_CHANNEL
Publications and Subscriptionspublic static final java.lang.String SPY_PREFIX
Subscriptions whereby an outgoing unicast or multicast publication can be spied on
by IPC without receiving it again via the network.public static final long DEFAULT_DRIVER_TIMEOUT_MS
public static final java.lang.String INITIAL_TERM_ID_PARAM_NAME
ExclusivePublication.public static final java.lang.String TERM_ID_PARAM_NAME
ExclusivePublication.public static final java.lang.String TERM_OFFSET_PARAM_NAME
ExclusivePublication.public static final java.lang.String TERM_LENGTH_PARAM_NAME
public static final java.lang.String MTU_LENGTH_URI_PARAM_NAME
public static final java.lang.String MDC_CONTROL_MODE
public static final java.lang.String MDC_CONTROL_MODE_MANUAL
MDC_CONTROL_MODE when manual control is desired.public static final java.lang.String RELIABLE_STREAM_PARAM_NAME
public CommonContext()
public static java.lang.String generateRandomDirName()
public CommonContext conclude()
public CommonContext concludeAeronDirectory()
aeronDirectory() so it does not need to keep being recreated.public java.lang.String aeronDirectoryName()
public java.io.File aeronDirectory()
conclude().aeronDirectoryName()public CommonContext aeronDirectoryName(java.lang.String dirName)
dirName - New top level Aeron directory.public static java.io.File newDefaultCncFile()
public org.agrona.concurrent.UnsafeBuffer countersMetaDataBuffer()
public CommonContext countersMetaDataBuffer(org.agrona.concurrent.UnsafeBuffer countersMetaDataBuffer)
countersMetaDataBuffer - The new counter meta data buffer.public org.agrona.concurrent.UnsafeBuffer countersValuesBuffer()
public CommonContext countersValuesBuffer(org.agrona.concurrent.UnsafeBuffer countersValuesBuffer)
countersValuesBuffer - The new counters buffer.public java.io.File cncFile()
public CommonContext driverTimeoutMs(long driverTimeoutMs)
driverTimeoutMs - to indicate liveness of driverpublic long driverTimeoutMs()
public void deleteAeronDirectory()
public java.nio.MappedByteBuffer mapExistingCncFile(java.util.function.Consumer<java.lang.String> logProgress)
logProgress - for feedbackpublic static boolean isDriverActive(java.io.File directory,
long driverTimeoutMs,
java.util.function.Consumer<java.lang.String> logProgress)
directory - to checkdriverTimeoutMs - for the driver liveness check.logProgress - for feedback as liveness checked.public boolean isDriverActive(long driverTimeoutMs,
java.util.function.Consumer<java.lang.String> logHandler)
driverTimeoutMs - for the driver liveness check.logHandler - for feedback as liveness checked.public static boolean isDriverActive(long driverTimeoutMs,
java.util.function.Consumer<java.lang.String> logProgress,
java.nio.MappedByteBuffer cncByteBuffer)
driverTimeoutMs - for the driver liveness check.logProgress - for feedback as liveness checked.cncByteBuffer - for the existing CnC file.public int saveErrorLog(java.io.PrintStream out)
PrintStreamout - to write the error log contents to.public int saveErrorLog(java.io.PrintStream out,
java.nio.MappedByteBuffer cncByteBuffer)
PrintStreamout - to write the error log contents to.cncByteBuffer - containing the error log.public void close()
close in interface java.lang.AutoCloseableCopyright © 2014-2017 Real Logic Ltd. All Rights Reserved.