public class AsyncHandler extends ExtHandler
| Modifier and Type | Class and Description |
|---|---|
private class |
AsyncHandler.AsyncTask |
static class |
AsyncHandler.OverflowAction |
| Modifier and Type | Field and Description |
|---|---|
private static int |
DEFAULT_QUEUE_LENGTH |
private AsyncHandler.OverflowAction |
overflowAction |
private int |
queueLength |
private java.util.concurrent.BlockingQueue<ExtLogRecord> |
recordQueue |
private int |
state |
private static java.util.concurrent.atomic.AtomicIntegerFieldUpdater<AsyncHandler> |
stateUpdater |
private java.lang.Thread |
thread |
handlers, handlersUpdater| Constructor and Description |
|---|
AsyncHandler()
Construct a new instance.
|
AsyncHandler(int queueLength)
Construct a new instance.
|
AsyncHandler(int queueLength,
java.util.concurrent.ThreadFactory threadFactory)
Construct a new instance.
|
AsyncHandler(java.util.concurrent.ThreadFactory threadFactory)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close all child handlers.
|
protected void |
doPublish(ExtLogRecord record)
Do the actual work of publication; the record will have been filtered already.
|
AsyncHandler.OverflowAction |
getOverflowAction()
Get the overflow action.
|
int |
getQueueLength()
The full size of the queue.
|
void |
setOverflowAction(AsyncHandler.OverflowAction overflowAction)
Set the overflow action.
|
addHandler, checkAccess, checkAccess, clearHandlers, disableAccess, enableAccess, flush, getHandlers, isAutoFlush, isEnabled, protect, publish, publish, removeHandler, setAutoFlush, setEnabled, setEncoding, setErrorManager, setFilter, setFormatter, setHandlers, setLevel, unprotectprivate final java.util.concurrent.BlockingQueue<ExtLogRecord> recordQueue
private final int queueLength
private final java.lang.Thread thread
private volatile AsyncHandler.OverflowAction overflowAction
private volatile int state
private static final java.util.concurrent.atomic.AtomicIntegerFieldUpdater<AsyncHandler> stateUpdater
private static final int DEFAULT_QUEUE_LENGTH
public AsyncHandler(int queueLength,
java.util.concurrent.ThreadFactory threadFactory)
queueLength - the queue lengththreadFactory - the thread factory to use to construct the handler threadpublic AsyncHandler(java.util.concurrent.ThreadFactory threadFactory)
threadFactory - the thread factory to use to construct the handler threadpublic AsyncHandler(int queueLength)
queueLength - the queue lengthpublic AsyncHandler()
public int getQueueLength()
public AsyncHandler.OverflowAction getOverflowAction()
public void setOverflowAction(AsyncHandler.OverflowAction overflowAction)
overflowAction - the overflow actionprotected void doPublish(ExtLogRecord record)
autoFlush property is set to true; if this behavior is to be
preserved in a subclass then this method should be called after the record is physically written.doPublish in class ExtHandlerrecord - the log record to publishpublic void close()
throws java.lang.SecurityException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class ExtHandlerjava.lang.SecurityException