public interface IRogMessageLogger
This interface defines a message logger. Message loggers are used to persist messages to a log.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
IRogMessageLogger.ErrorHandler
Callback interface to report logging errors
|
static interface |
IRogMessageLogger.IMessageReceiver
Receiver of messages read by
read(com.neeve.rog.IRogMessageLogger.IMessageReceiver) |
static interface |
IRogMessageLogger.Stats
Logger statistics
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close a message logger.
|
void |
delete()
Delete the underlying log file
|
void |
flush(boolean sync)
Flush cached message to the log.
|
IRogMessageLogger.ErrorHandler |
getErrorHandler()
Get a logger's error handler.
|
String |
getName()
Get the name of a logger.
|
long |
getPositionInLog(IRogMessage message)
Get the position of a read message in the log
|
int |
getSizeInLog(IRogMessage message)
Get the size of a read message in the log
|
IRogMessageLogger.Stats |
getStats()
Gets a logger's stats.
|
boolean |
isOpen()
Get if the log is open
|
boolean |
isReadInProgress()
Get if a log read is in progress
|
void |
log(IRogMessage message)
Log a message.
|
void |
log(IRogMessage message,
boolean commitStart,
boolean commitEnd)
Log a message.
|
void |
log(IRogMessage message,
boolean commitStart,
boolean commitEnd,
boolean sync)
Log a message.
|
void |
open()
Open a message logger.
|
void |
read(IRogMessageLogger.IMessageReceiver receiver)
Read the contents of the log from the beginning of the log.
|
IRogMessage |
readAt(long pos)
Read the one message from a specific position in the log
|
void |
readFrom(long pos,
IRogMessageLogger.IMessageReceiver receiver)
Read the contents of the log from a specific position in the log.
|
IRogMessage |
readOne()
Read the one message from the current position in the log
|
void |
setErrorHandler(IRogMessageLogger.ErrorHandler errorHandler)
Set a logger's error handler.
|
void |
stopRead()
|
boolean |
wasRepaired()
Indicates whether the message log was repaired during open.
|
String getName()
void setErrorHandler(IRogMessageLogger.ErrorHandler errorHandler)
IRogMessageLogger.ErrorHandler getErrorHandler()
boolean isOpen()
boolean wasRepaired()
IRogMessageLogger.Stats getStats()
boolean isReadInProgress()
IRogMessage readAt(long pos)
pos - The position in the log the message fromIRogMessage readOne()
void readFrom(long pos,
IRogMessageLogger.IMessageReceiver receiver)
pos - The position in the log to read from. A value of 0 will
read the message from the beginning of the file.cb - The callback to invoke to dispatch messages read from the log.void read(IRogMessageLogger.IMessageReceiver receiver)
cb - The callback to invoke to dispatch messages read from the log.void stopRead()
long getPositionInLog(IRogMessage message)
IllegalArgumentException - thrown if the supplied message was not one
received via the a message logger read methodint getSizeInLog(IRogMessage message)
IllegalArgumentException - thrown if the supplied message was not one
received via the a message logger read methodvoid log(IRogMessage message, boolean commitStart, boolean commitEnd, boolean sync)
message - The message to log.commitStart - Indicates whether to mark this log entry as
the start of an application commit leg.commitEnd - Indicates whether to mark this log entry as
the end of an application commit leg.sync - Indicates whether this write should trigger a flush
with a sync i.e. any data buffered in local memory by prior
calls to this method should be synchornously flushed through to
its destination i.e. cut through all intermediate caches and
buffers such as OS caches, CPU caches and network buffers to
it final destination.Note: The logger can be configured to log a message is a detached manner i.e. upon return from this call, the message may still be in flight for logging. Therefore, a message being logged CANNOT be modified after return from this call.
void log(IRogMessage message, boolean commitStart, boolean commitEnd)
Invoking this method is equivalent to invoking log(message, commitStart, commitEnd, false)
void log(IRogMessage message)
Invoking this method is equivalent to invoking log(message, true, true)
void flush(boolean sync)
sync - Indicates if the flush should sync to the durable mediavoid delete()
throws IOException
IOExceptionvoid close()
Copyright © 2019 N5 Technologies, Inc. All Rights Reserved.