org.jwall.web.audit.io
Class BufferedAuditEventSource
java.lang.Object
java.lang.Thread
org.jwall.web.audit.io.BufferedAuditEventSource
- All Implemented Interfaces:
- Runnable, AuditEventSource
public class BufferedAuditEventSource
- extends Thread
- implements AuditEventSource
This is an implementation of a buffered event-source. Events
are read in a separate thread an stored in memory until they
are fetched by the nextEvent method.
The buffer size is given at creation time.
- Author:
- Christian Bockermann <chris@jwall.org>
|
Method Summary |
boolean |
hasNext()
This method returns true if there is at least one more event pending, so
if hasNext returns true, the next call to nextEvent
should neither fail nor throw an exception. |
AuditEvent |
nextEvent()
Returns the next available AuditEvent. |
void |
run()
This method loops forever, waiting for new events to arrive. |
void |
setFilter(AuditEventFilter filter)
This sets a filter on the source. |
| 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 |
BufferedAuditEventSource
public BufferedAuditEventSource(AuditEventReader evtReader)
BufferedAuditEventSource
public BufferedAuditEventSource(AuditEventReader evtReader,
int bufSize)
- This creates a buffered source that fetches events from the
reader given as
evtReader and stores up to
bufSize events in memory. If the internal
event-queue is full, it will block.
- Parameters:
evtReader - bufSize -
hasNext
public boolean hasNext()
- Description copied from interface:
AuditEventSource
- This method returns true if there is at least one more event pending, so
if
hasNext returns true, the next call to nextEvent
should neither fail nor throw an exception.
- Specified by:
hasNext in interface AuditEventSource
- Returns:
true iff there is another event available.- See Also:
AuditEventSource.hasNext()
nextEvent
public AuditEvent nextEvent()
- Description copied from interface:
AuditEventSource
- Returns the next available AuditEvent. If no event is available
null
is returned.
- Specified by:
nextEvent in interface AuditEventSource
- Returns:
- The next event.
- See Also:
AuditEventSource.nextEvent()
setFilter
public void setFilter(AuditEventFilter filter)
- Description copied from interface:
AuditEventSource
- This sets a filter on the source. A source should only return events that
match this filter or all events, if no filter is set.
To disable filtering filter can be set to
null.
- Specified by:
setFilter in interface AuditEventSource
- Parameters:
filter - The filter that determines the events which are returned.- See Also:
org.jwall.web.audit.io.AuditEventSource#setFilter(org.jwall.web.audit.AuditEventFilter)
run
public void run()
- This method loops forever, waiting for new events to arrive.
- Specified by:
run in interface Runnable- Overrides:
run in class Thread
- See Also:
Thread.run()
Copyright © 2012 jwall.org. All Rights Reserved.