public interface LogWriter extends Runnable
Writers normally run on a background thread, gathering messages into batches and sending them based on a time delay. Writers can also operate in "synchronous" mode, in which batch building/sending is triggered by the appender.
| Modifier and Type | Method and Description |
|---|---|
void |
addMessage(LogMessage message)
Adds a message to the writer's message queue.
|
boolean |
isSynchronous()
Returns a flag to indicate whether the writer is operating in synchrnous mode.
|
int |
maxMessageSize()
Returns the maximum allowed UTF-8 message size for the destination.
|
void |
setBatchDelay(long value)
Sets the batch delay for the writer.
|
void |
setDiscardAction(MessageQueue.DiscardAction value)
Updates the writer's discard action: how it discards messages once the threshold
has been reached.
|
void |
setDiscardThreshold(int value)
Updates the writer's discard threshold: the maximum number of message stored
in its queue.
|
void |
stop()
Signals the writer that it will no longer receive batches.
|
boolean |
waitUntilInitialized(long millisToWait)
Waits up to the specified amount of time for the writer to initialize.
|
void |
waitUntilStopped(long millisToWait)
Waits until the writer thread has stopped, the timeout has expired, or the
calling thread is interrupted.
|
void setBatchDelay(long value)
This is a no-op if the writer doesn't support batching or is in synchronous mode.
void setDiscardThreshold(int value)
void setDiscardAction(MessageQueue.DiscardAction value)
boolean isSynchronous()
int maxMessageSize()
boolean waitUntilInitialized(long millisToWait)
true if it initialized successfully, false
if writer failed to initialize, the timeout expired, or the calling
thread was interrupted.void addMessage(LogMessage message)
Implementations should assume that they are invoked within a synchronized block, and therefore should not perform excessive amounts work (synchronous mode being an exception).
void stop()
run() method.void waitUntilStopped(long millisToWait)
Copyright © 2023. All rights reserved.