|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sag.osami.context.recorder.ContextStoreReplay
public class ContextStoreReplay
This class handles the replaying of recorded context events.
It utilizes two threads for this: a Replay- and a Reader-thread. The task of the Reader-thread is to read the context event data from the recording input stream and to put ready-to-use context events into a buffer. The task of the Replay-thread is to fetch these context events from the buffer and to pass them to the ContextStore in the correct order and with correct time intervals between the context events.
The buffer is a bounded LinkedBlockingQueue
, resulting in the following (desired) behavior of the threads:
When the buffer is full, the Reader-thread blocks until a free slot becomes available.
When the buffer is empty, the Replay-thread blocks until a context event becomes available (should rarely happen).
In effect, the memory consumption should remain low and on the other hand, the replaying thread should never wait unnecessarily as a result of context event reading/parsing.
Constructor Summary | |
---|---|
ContextStoreReplay(ISerializedContextReceiver ctxStore)
Default constructor. |
Method Summary | |
---|---|
void |
runOnFinish(java.lang.Runnable callback)
Defines a callback which is to be run after a replay was stopped or finished. |
void |
start(java.io.DataInputStream recordingData)
Starts the replay of a recording, i.e. starts the Reader- and Replay-thread. |
void |
stop()
Stops the replay of a recording, i.e. stops the Reader- and Replay-thread. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ContextStoreReplay(ISerializedContextReceiver ctxStore)
ctxStore
- ContextStore which receives the replayed (serialized) context eventsMethod Detail |
---|
public void start(java.io.DataInputStream recordingData)
public void stop()
public void runOnFinish(java.lang.Runnable callback)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |