private static class EventLogFactory.EventLogIteratorImpl extends Object implements EventLogIterator
| Modifier and Type | Field and Description |
|---|---|
private EventLog |
log
The associated EventLog for this iterator
|
private Uuid |
uuid
The associated Uuid for this iterator
|
| Constructor and Description |
|---|
EventLogIteratorImpl(Uuid id)
Simple constructor that assigns the Uuid
field to the appropriate internal field and creates
a transient event log.
|
EventLogIteratorImpl(Uuid id,
File logPath)
Simple constructor that assigns the Uuid
field to the appropriate internal field and creates
a persistent EventLog object using the provided
File argument.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(RemoteEvent evt)
Store the given RemoteEvent event.
|
void |
destroy()
Destroy the collection of stored events.
|
boolean |
hasNext()
Return true if there are any events in the collection and
false otherwise.
|
void |
init() |
void |
moveAhead(Object cookie)
Effectively removes the last set of read events from the log.
|
RemoteEvent |
next()
Return the next event in the collection.
|
RemoteEventData[] |
readAhead(int maxEvents)
Return an array of RemoteEventData with a limit of
maxEvents elements.
|
void |
remove()
Remove the event at the iterator's current cursor position.
|
private final Uuid uuid
private EventLog log
EventLogIteratorImpl(Uuid id, File logPath)
EventLogIteratorImpl(Uuid id)
public void init()
throws IOException
IOExceptionpublic void add(RemoteEvent evt) throws IOException, IllegalArgumentException
EventLogIteratoradd in interface EventLogIteratorIOException - if an I/O errors occursIllegalArgumentExceptionpublic boolean hasNext()
throws IOException
EventLogIteratorhasNext in interface EventLogIteratorIOException - if an I/O errors occurspublic RemoteEvent next() throws IOException, ClassNotFoundException, NoSuchElementException
EventLogIteratornext in interface EventLogIteratorIOException - if an I/O errors occursClassNotFoundException - if there was a problem deserializing
the stored RemoteEventNoSuchElementException - if there are no available
RemoteEventspublic void remove()
throws IOException,
IllegalStateException
EventLogIteratorremove in interface EventLogIteratorIOException - if an I/O errors occursIllegalStateExceptionpublic RemoteEventData[] readAhead(int maxEvents) throws IOException, ClassNotFoundException
EventLogIteratorreadAhead in interface EventLogIteratormaxEvents - maximum number of events/elements to returnIOException - if an I/O error occursClassNotFoundException - if a class for the serialized
object could not be foundpublic void moveAhead(Object cookie) throws IOException
EventLogIteratormoveAhead in interface EventLogIteratorcookie - object associated with event to read past. This object
should have been obtained from a previous call to readAhead
on this event log.IOException - if there was a problem advancing the read pointer.public void destroy()
throws IOException
EventLogIteratordestroy in interface EventLogIteratorIOException - if an I/O errors occursCopyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.