|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
org.jwall.web.audit.io.BufferedAuditEventWriter
public class BufferedAuditEventWriter
This class implements a simple persistency thread. It is created by specifying an AuditEventWriter implementation used for writing the events to disk. Upon startup, it waits for new events to arrive and writes them to disk asynchronously.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
Thread.State, Thread.UncaughtExceptionHandler |
| Field Summary |
|---|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
BufferedAuditEventWriter(AuditEventWriter wr)
This creates a new buffered event-writer that uses the given event-writer implementation to write audit-events to disk. |
|
| Method Summary | |
|---|---|
void |
add(AuditEvent evt)
Add a new event to the list of events that need to be written to disk. |
void |
addAll(Collection<AuditEvent> evts)
This method can be used to add a collection of events to the queue. |
void |
close()
This method sets the finish-signal for this writer instance. |
void |
eventArrived(AuditEvent evt)
This method is called when a new event arrives at the listener. |
void |
eventsArrived(Collection<AuditEvent> events)
This method is called for notifying the listener of arrival of several events in a block. |
boolean |
hasEventsPending()
This method can be used to check if any events are pending to be written to disk by the underlying writer. |
void |
run()
This method loops until the finished-method has been called. |
void |
writeEvent(AuditEvent evt)
This method simply enqueue the event evt to the list
of events waiting to be written to disk. |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public BufferedAuditEventWriter(AuditEventWriter wr)
wr - An instance that implements the AuditEventWriter interface.| Method Detail |
|---|
public void run()
run in interface Runnablerun in class ThreadThread.run()public void add(AuditEvent evt)
evt - The event to be written.public void addAll(Collection<AuditEvent> evts)
add(AuditEvent evt)-method this might block if the maximum size of
the internal queue is reached.
evts - A collection of events that are to be written.public void close()
public boolean hasEventsPending()
true, iff the event-queue is not empty.
public void writeEvent(AuditEvent evt)
throws IOException
evt to the list
of events waiting to be written to disk.
writeEvent in interface AuditEventWriterIOExceptionpublic void eventArrived(AuditEvent evt)
AuditEventListener
After the dispatcher calls this method each listener gets a call to
#notify(), thus a listener might wait for packets to arrive.
eventArrived in interface EventListener<AuditEvent>eventArrived in interface AuditEventListenerevt - The event which arrived.public void eventsArrived(Collection<AuditEvent> events)
AuditEventListenerAuditEventListener.eventArrived(AuditEvent) for each of the given
events, but may be handled in a more efficient way by implementations
capable of processing blocks of events.
eventsArrived in interface AuditEventListenerevents - The block of events arrived.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||