public class LossReport
extends java.lang.Object
The provided AtomicBuffer
can wrap a memory-mapped file so logging can be out of process. This provides
the benefit that if a crash or lockup occurs then the log can be read externally without loss of data.
Note:This class is NOT threadsafe to be used from multiple logging threads.
The error records are recorded to the memory mapped buffer in the following format.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |R| Observation Count | | | +-+-------------------------------------------------------------+ |R| Total Bytes Lost | | | +---------------------------------------------------------------+ | First Observation Timestamp | | | +---------------------------------------------------------------+ | Last Observation Timestamp | | | +---------------------------------------------------------------+ | Session ID | +---------------------------------------------------------------+ | Stream ID | +---------------------------------------------------------------+ | Channel encoded in US-ASCII ... ... | +---------------------------------------------------------------+ | Source encoded in US-ASCII ... ... | +---------------------------------------------------------------+
Modifier and Type | Class and Description |
---|---|
static class |
LossReport.ReportEntry
Report entry for a specific stream.
|
Modifier and Type | Field and Description |
---|---|
static int |
CHANNEL_OFFSET
Offset within an entry at which the channel field begins.
|
static int |
ENTRY_ALIGNMENT
Alignment to be applied for each entry offset.
|
static int |
FIRST_OBSERVATION_OFFSET
Offset within an entry at which the first observation field begins.
|
static int |
LAST_OBSERVATION_OFFSET
Offset within an entry at which the last observation field begins.
|
static int |
OBSERVATION_COUNT_OFFSET
Offset within an entry at which the observation count begins.
|
static int |
SESSION_ID_OFFSET
Offset within an entry at which the session id field begins.
|
static int |
STREAM_ID_OFFSET
Offset within an entry at which the stream id field begins.
|
static int |
TOTAL_BYTES_LOST_OFFSET
Offset within an entry at which the total bytes field begins.
|
Constructor and Description |
---|
LossReport(org.agrona.concurrent.AtomicBuffer buffer)
Create a loss report which wraps a buffer which is ideally memory mapped so it can
be read from another process.
|
Modifier and Type | Method and Description |
---|---|
LossReport.ReportEntry |
createEntry(long initialBytesLost,
long timestampMs,
int sessionId,
int streamId,
java.lang.String channel,
java.lang.String source)
Create a new entry for recording loss on a given stream.
|
public static final int ENTRY_ALIGNMENT
public static final int OBSERVATION_COUNT_OFFSET
public static final int TOTAL_BYTES_LOST_OFFSET
public static final int FIRST_OBSERVATION_OFFSET
public static final int LAST_OBSERVATION_OFFSET
public static final int SESSION_ID_OFFSET
public static final int STREAM_ID_OFFSET
public static final int CHANNEL_OFFSET
public LossReport(org.agrona.concurrent.AtomicBuffer buffer)
buffer
- to be wrapped.public LossReport.ReportEntry createEntry(long initialBytesLost, long timestampMs, int sessionId, int streamId, java.lang.String channel, java.lang.String source)
If not space is remaining in the error report then null is returned.
initialBytesLost
- on the stream.timestampMs
- at which the first loss was observed.sessionId
- for the stream.streamId
- for the stream.channel
- for the stream.source
- of the stream.Copyright © 2014-2018 Real Logic Ltd. All Rights Reserved.