Top Description Inners Fields Constructors Methods
org.jboss.logmanager.handlers

public Class AsyncHandler

extends ExtHandler
Class Inheritance
Imports
java.util.concurrent.ArrayBlockingQueue, .BlockingQueue, .Executors, .ThreadFactory, java.util.concurrent.atomic.AtomicIntegerFieldUpdater, java.util.logging.Handler, org.jboss.logmanager.ExtHandler, .ExtLogRecord

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 and Inner Type Summary

Modifier and TypeClass and Description
private class
public static enum

Field Summary

Modifier and TypeField and Description
private static final int
private volatile AsyncHandler.OverflowAction
private final int
private final BlockingQueue<ExtLogRecord>
private volatile int
private static final AtomicIntegerFieldUpdater<AsyncHandler>
private final Thread
Inherited from org.jboss.logmanager.ExtHandler:
handlershandlersUpdaterlock

Constructor Summary

AccessConstructor and Description
public
AsyncHandler(final int
the queue length
queueLength
,
final ThreadFactory
the thread factory to use to construct the handler thread
threadFactory
)

Construct a new instance.

public
AsyncHandler(final ThreadFactory
the thread factory to use to construct the handler thread
threadFactory
)

Construct a new instance.

public
AsyncHandler(final int
the queue length
queueLength
)

Construct a new instance.

public
AsyncHandler()

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides org.jboss.logmanager.ExtHandler.close.

Implements java.lang.AutoCloseable.close.

Close all child handlers.

protected void
doPublish(final ExtLogRecord
the log record to publish
record
)

Overrides org.jboss.logmanager.ExtHandler.doPublish.

Do the actual work of publication; the record will have been filtered already.

public AsyncHandler.OverflowAction

Returns:

the overflow action
getOverflowAction
()

Get the overflow action.

public int

Returns:

the full size of the queue.
getQueueLength
()

The full size of the queue.

public void
setOverflowAction(final AsyncHandler.OverflowAction
the overflow action
overflowAction
)

Set the overflow action.

Inherited from org.jboss.logmanager.ExtHandler:
addHandlercheckAccesscheckAccessclearHandlersflushgetCharsetgetEncodinggetErrorManagergetFiltergetFormattergetHandlersgetLevelisAutoFlushisCallerCalculationRequiredisCloseChildrenisEnabledpublishpublishpublishToNestedHandlersremoveHandlerreportErrorreportErrorsetAutoFlushsetCharsetsetCharsetPrivatesetCloseChildrensetEnabledsetEncodingsetErrorManagersetFiltersetFormattersetHandlerssetLevel

Field Detail

DEFAULT_QUEUE_LENGTHback to summary
private static final int DEFAULT_QUEUE_LENGTH
overflowActionback to summary
private volatile AsyncHandler.OverflowAction overflowAction
queueLengthback to summary
private final int queueLength
recordQueueback to summary
private final BlockingQueue<ExtLogRecord> recordQueue
stateback to summary
private volatile int state
Annotations
@SuppressWarnings:unused
stateUpdaterback to summary
private static final AtomicIntegerFieldUpdater<AsyncHandler> stateUpdater
threadback to summary
private final Thread thread

Constructor Detail

AsyncHandlerback to summary
public AsyncHandler(final int queueLength, final ThreadFactory threadFactory)

Construct a new instance.

Parameters
queueLength:int

the queue length

threadFactory:ThreadFactory

the thread factory to use to construct the handler thread

AsyncHandlerback to summary
public AsyncHandler(final ThreadFactory threadFactory)

Construct a new instance.

Parameters
threadFactory:ThreadFactory

the thread factory to use to construct the handler thread

AsyncHandlerback to summary
public AsyncHandler(final int queueLength)

Construct a new instance.

Parameters
queueLength:int

the queue length

AsyncHandlerback to summary
public AsyncHandler()

Construct a new instance.

Method Detail

closeback to summary
public void close() throws SecurityException

Overrides org.jboss.logmanager.ExtHandler.close.

Implements java.lang.AutoCloseable.close.

Doc from org.jboss.logmanager.ExtHandler.close.

Close all child handlers.

Exceptions
SecurityException:

Doc from java.util.logging.Handler.close.

if a security manager exists and if the caller does not have LoggingPermission("control").

doPublishback to summary
protected void doPublish(final ExtLogRecord record)

Overrides org.jboss.logmanager.ExtHandler.doPublish.

Doc from org.jboss.logmanager.ExtHandler.doPublish.

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.

Parameters
record:ExtLogRecord

the log record to publish

getOverflowActionback to summary
public AsyncHandler.OverflowAction getOverflowAction()

Get the overflow action.

Returns:AsyncHandler.OverflowAction

the overflow action

getQueueLengthback to summary
public int getQueueLength()

The full size of the queue.

Returns:int

the full size of the queue.

setOverflowActionback to summary
public void setOverflowAction(final AsyncHandler.OverflowAction overflowAction)

Set the overflow action.

Parameters
overflowAction:AsyncHandler.OverflowAction

the overflow action

org.jboss.logmanager.handlers back to summary

private final Class AsyncHandler.AsyncTask

extends Object
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

AsyncTaskback to summary
private AsyncTask()

Method Detail

runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

org.jboss.logmanager.handlers back to summary

public final Enum AsyncHandler.OverflowAction

extends Enum<AsyncHandler.OverflowAction>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final AsyncHandler.OverflowAction
public static final AsyncHandler.OverflowAction

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static AsyncHandler.OverflowAction
public static AsyncHandler.OverflowAction[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

BLOCKback to summary
public static final AsyncHandler.OverflowAction BLOCK
DISCARDback to summary
public static final AsyncHandler.OverflowAction DISCARD

Constructor Detail

OverflowActionback to summary
private OverflowAction()

Method Detail

valueOfback to summary
public static AsyncHandler.OverflowAction valueOf(String name)
valuesback to summary
public static AsyncHandler.OverflowAction[] values()