Class AsynchronousAuditMessageQueue
java.lang.Object
org.openehealth.ipf.commons.audit.queue.AbstractAuditMessageQueue
org.openehealth.ipf.commons.audit.queue.AsynchronousAuditMessageQueue
- All Implemented Interfaces:
AuditMessageQueue
Audit queue that uses an injectable
ExecutorService
to asynchronously send away audit events.
When this queue is shut down
, the executor service is also, waiting for at most
shutdownTimeoutSeconds
until all pending events are sent.
Note that the ExecutorService
must be explicitly set, otherwise the implementation sends away the event synchronously.
The parameters of the ExecutorService
determine the behavior of the queue implementation, e.g. in case the
audit destination is not reachable.
- Since:
- 3.5
- Author:
- Christian Ohr
-
Field Summary
Fields inherited from interface org.openehealth.ipf.commons.audit.queue.AuditMessageQueue
X_IPF_ATNA_APPLICATION, X_IPF_ATNA_HOSTNAME, X_IPF_ATNA_PROCESSID, X_IPF_ATNA_TIMESTAMP
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
handle
(AuditContext auditContext, String auditRecord) void
setExecutorService
(ExecutorService executorService) Sets the executor service.void
setShutdownTimeoutSeconds
(int shutdownTimeoutSeconds) Sets the timeout before the executor service closes.void
shutdown()
Flushes the queue and shutdown any associated runtime daemons that may be handling queue inflow/outflowMethods inherited from class org.openehealth.ipf.commons.audit.queue.AbstractAuditMessageQueue
audit, setPretty
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.openehealth.ipf.commons.audit.queue.AuditMessageQueue
flush
-
Constructor Details
-
AsynchronousAuditMessageQueue
public AsynchronousAuditMessageQueue()
-
-
Method Details
-
setExecutorService
Sets the executor service. If this is null (or not used), audit events are sent synchronously- Parameters:
executorService
- executor service
-
setShutdownTimeoutSeconds
public void setShutdownTimeoutSeconds(int shutdownTimeoutSeconds) Sets the timeout before the executor service closes. Defaults to 10- Parameters:
shutdownTimeoutSeconds
- timeout before the executor service closes
-
handle
- Specified by:
handle
in classAbstractAuditMessageQueue
-
shutdown
public void shutdown()Description copied from interface:AuditMessageQueue
Flushes the queue and shutdown any associated runtime daemons that may be handling queue inflow/outflow
-