public class AuditEventQueue extends Object implements AuditEventSource, AuditEventReader, AuditEventListener
| Modifier and Type | Field and Description |
|---|---|
protected long |
polled
A counter of all event that have been read from the queue
|
| Constructor and Description |
|---|
AuditEventQueue()
This creates new empty queue for holding audit events.
|
AuditEventQueue(Collection<AuditEvent> evts)
This creates a new queue which is initially filled with the
given set of events.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
atEOF() |
long |
bytesAvailable() |
long |
bytesRead() |
void |
close() |
void |
eventArrived(AuditEvent evt)
This method will add the event
evt to the queue. |
void |
eventsArrived(Collection<AuditEvent> events)
This method is called for notifying the listener of arrival of
several events in a block.
|
boolean |
hasNext()
This method returns
true, iff the queue is
non-empty. |
Iterator<AuditEvent> |
iterator() |
AuditEvent |
nextEvent()
This method will return the head of the queue, i.e. the
events that has been in the queue for the longest term.
|
AuditEvent |
readNext()
This method tries to read the next event that is available.
|
void |
setFilter(AuditEventFilter filter)
This method sets a filter for the queue instance.
|
int |
size()
This returns the number of events currently in the queue.
|
public AuditEventQueue()
public AuditEventQueue(Collection<AuditEvent> evts)
evts - The initial set of events.public boolean hasNext()
true, iff the queue is
non-empty. A return-value of true does not
guarantee that the next call to nextEvent
will not block, as a different thread might have emptied
the list in the meantime.hasNext in interface AuditEventSourcetrue, iff queue is not empty.public AuditEvent nextEvent()
nextEvent in interface AuditEventSourcepublic void setFilter(AuditEventFilter filter)
setFilter in interface AuditEventSourcefilter - The filter used to match arriving events.public void eventArrived(AuditEvent evt)
evt to the queue. If
a filter has been set beforehand, the event will only be added
if it matches the filter.eventArrived in interface EventListener<AuditEvent>eventArrived in interface AuditEventListenerevt - The event which arrived.AuditEventListener.eventArrived(org.jwall.web.audit.AuditEvent)public int size()
public long bytesAvailable()
bytesAvailable in interface AuditEventReaderAuditEventReader.bytesAvailable()public long bytesRead()
bytesRead in interface AuditEventReaderAuditEventReader.bytesRead()public void close()
throws IOException
close in interface AuditEventReaderIOExceptionAuditEventReader.close()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.public AuditEvent readNext() throws IOException, ParseException
AuditEventReaderreadNext in interface AuditEventReaderNULL if no event is available.IOExceptionParseExceptionAuditEventReader.readNext()public boolean atEOF()
atEOF in interface AuditEventReaderpublic Iterator<AuditEvent> iterator()
iterator in interface Iterable<AuditEvent>Copyright © 2015 jwall.org. All Rights Reserved.