How exactly does the async logging handler work in JBoss EAP 6?

Solution Verified - Updated -

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 6

Issue

How exactly does the asynchronous logging handler work?

Resolution

The JBoss AsyncHandler has a queue data structure (java.util.concurrent.ArrayBlockingQueue) that contains all of the log messages that are queued to be processed. When it receives a log message, it simply puts the message on the queue and returns. If the queue is already full, it either blocks until it's available or discards the message, depending on the configuration.

Upon receiving its first message, the async handler will spawn a persistent thread that will actually process all new messages. The thread will block until there is a new message in the queue. When there are messages to process, it will publish the message to every handler attached to the async handler.

So the logging handlers are invoked in exactly the same way as they are when the AsyncHandler is not involved; it's just done in a separate thread so it doesn't block application processing if a handler is stuck writing out a message or is overloaded.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.