public class CommonContext
extends java.lang.Object
implements java.lang.AutoCloseable
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 |
IPC_CHANNEL
URI used for IPC
Publication s and Subscription s |
static java.lang.String |
SPY_PREFIX
URI used for Spy
Subscription s 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_LENGTH_PARAM_NAME
The param name to be used for the term length as a channel URI parameter.
|
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.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.
|
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.
|
boolean |
isDriverActive(long driverTimeoutMs,
java.util.function.Consumer<java.lang.String> logHandler)
Is a media driver active in the current Aeron directory?
|
static java.io.File |
newDefaultCncFile()
Create a new command and control file in the administration directory.
|
int |
saveErrorLog(java.io.PrintStream stream)
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
Publication
s and Subscription
spublic static final java.lang.String SPY_PREFIX
Subscription
s 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 TERM_LENGTH_PARAM_NAME
public CommonContext()
public static java.lang.String generateRandomDirName()
public CommonContext conclude()
public java.lang.String 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 boolean isDriverActive(long driverTimeoutMs, java.util.function.Consumer<java.lang.String> logHandler)
driverTimeoutMs
- for the driver liveness checklogHandler
- for feedback as liveness checkedpublic int saveErrorLog(java.io.PrintStream stream)
PrintStream
stream
- to write the error log contents to.public void close()
close
in interface java.lang.AutoCloseable
Copyright © 2014 - 2016 Real Logic Ltd. All Rights Reserved.