|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
interface EventLog
Interface implemented by event storage objects. This class encapsulates the details of reading/writing events from/to some underlying persistence mechanism. This interface makes certain assumptions. First, the next and remove methods are intended to be called in pairs. If remove is not called, then subsequent calls to next will attempt to return the same object. Calling remove essentially advances the read pointer to the next object, if any. Second, if any IOExceptions are encountered during the reading or writing of an event the associated read/write pointer is advanced past the offending event. This means that events can be lost if I/O errors are encountered.
Method Summary | |
---|---|
void |
add(RemoteEvent event)
Writes the given RemoteEvent to the underlying storage mechanism, if possible. |
void |
close()
Close this log and release any associated runtime resources. |
void |
delete()
Delete associated storage resources for this log. |
void |
init()
Initializes the state of this EventLog object. |
boolean |
isEmpty()
Returns true if this log contains no events and false otherwise. |
void |
moveAhead(Object cookie)
Effectively removes the last set of read events from the log. |
RemoteEvent |
next()
Return the next RemoteEvent to be read. |
RemoteEventData[] |
readAhead(int maxEvents)
Return an array of RemoteEventData with a limit of maxEvents elements. |
void |
remove()
Effectively removes the last read event from the log. |
Method Detail |
---|
void init() throws IOException
IOException
- if an I/O error occursvoid add(RemoteEvent event) throws IOException
IOException
- if an I/O error occursRemoteEvent next() throws IOException, ClassNotFoundException
IOException
- if an I/O error occurs
ClassNotFoundException
- if a class for the serialized
object could not be found
NoSuchElementException
- if no event is availableboolean isEmpty() throws IOException
IOException
void remove() throws IOException
NoSuchElementException
- if no events are available
IOException
RemoteEventData[] readAhead(int maxEvents) throws IOException, ClassNotFoundException
maxEvents
- maximum number of events/elements to return
IOException
- if an I/O error occurs
ClassNotFoundException
- if a class for the serialized
object could not be found
NoSuchElementException
- if no event is availablevoid moveAhead(Object cookie) throws IOException
cookie
- object associated with event to read past. This object
should have been obtained from a call to
getCookie()
on a RemoteEventData
object
obtained from a call to readAhead
on this event log.
IOException
- if there was a problem advancing the read pointer.
NullPointerException
- if cookie
is null.
ClassCastException
- if cookie
is not an expected type.void close() throws IOException
IOException
void delete() throws IOException
IOException
- if an IO error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |