org.jboss.logmanager.handlers

## Class AsyncHandler

- java.lang.Object
- - java.util.logging.Handler
  - - org.jboss.logmanager.ExtHandler
    - - org.jboss.logmanager.handlers.AsyncHandler

All Implemented Interfaces:
  Closeable, Flushable, AutoCloseable, FlushableCloseable, Protectable

    public class AsyncHandler
    extends ExtHandler

An asynchronous log handler which is used to write to a handler or group of handlers which are "slow" or introduce some degree of latency.

### Nested Class Summary

Nested Classes
`static class` `AsyncHandler.OverflowAction`

### Field Summary

### Fields inherited from class org.jboss.logmanager.ExtHandler

`handlers, handlersUpdater`

### Constructor Summary

Constructors
Constructor and Description
`AsyncHandler()` Construct a new instance.
`AsyncHandler(int queueLength)` Construct a new instance.
`AsyncHandler(int queueLength, ThreadFactory threadFactory)` Construct a new instance.
`AsyncHandler(ThreadFactory threadFactory)` Construct a new instance.

### Method Summary

Methods
`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.

### Methods inherited from class org.jboss.logmanager.ExtHandler

`addHandler, checkAccess, checkAccess, clearHandlers, disableAccess, enableAccess, flush, getHandlers, isAutoFlush, isEnabled, protect, publish, publish, removeHandler, setAutoFlush, setEnabled, setEncoding, setErrorManager, setFilter, setFormatter, setHandlers, setLevel, unprotect`

### Methods inherited from class java.util.logging.Handler

`getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### AsyncHandler

    public AsyncHandler(int queueLength,
                ThreadFactory threadFactory)

Construct a new instance.

Parameters:
  `queueLength` - the queue length
  `threadFactory` - the thread factory to use to construct the handler thread

#### AsyncHandler

    public AsyncHandler(ThreadFactory threadFactory)

Construct a new instance.

Parameters:
  `threadFactory` - the thread factory to use to construct the handler thread

#### AsyncHandler

    public AsyncHandler(int queueLength)

Construct a new instance.

Parameters:
  `queueLength` - the queue length

#### AsyncHandler

    public AsyncHandler()

Construct a new instance.

### Method Detail

#### getQueueLength

    public int getQueueLength()

The full size of the queue.

Returns:
  the full size of the queue.

#### getOverflowAction

    public AsyncHandler.OverflowAction getOverflowAction()

Get the overflow action.

Returns:
  the overflow action

#### setOverflowAction

    public void setOverflowAction(AsyncHandler.OverflowAction overflowAction)

Set the overflow action.

Parameters:
  `overflowAction` - the overflow action

#### doPublish

    protected void doPublish(ExtLogRecord record)

Do the actual work of publication; the record will have been filtered already. The default implementation does nothing except to flush if the `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.

Overrides:
  `doPublish` in class `ExtHandler`
Parameters:
  `record` - the log record to publish

#### close

    public void close()
               throws SecurityException

Close all child handlers.

Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `AutoCloseable`
Overrides:
  `close` in class `ExtHandler`
Throws:
  `SecurityException`