|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IEventFrame
An event frame groups events from an IEventSource
object into a unit
of work.
An event frame has a repeating execution life-cycle:
start -> add event -> commit events ˆ ˆ | | | |____| | |________________________|The life-cycle stages are thread bound except for the 'add events' stage; the starting thread has to execute the 'commit events' stage. This thread is known as the event frame thread. Any thread can execute in the 'add events' stage. The distinction arises so that a publisher thread can control when an event frame starts and commits events, whilst separate threads can provide the events that form the event frame's unit of work.
An event frame is loosely analogous to a transaction, but with no concurrency or roll-back. Two threads that want to start an event frame on the same event source object have to do so sequentially:
| thread #1 frame | | thread #2 frame |
Method Summary | |
---|---|
void |
addEvent(IEvent event)
Add an event to an event frame. |
void |
beginFrame(IEventFrameExecution frame)
An event frame life-cycle control method to start an event frame. |
void |
endFrame()
An event frame life-cycle control method to commit all events within an event frame. |
void |
flushFrame()
A convenience method to perform the event frame life-cycle methods at once. |
boolean |
isFrameActive()
Identifies if an event frame is currently active. |
Method Detail |
---|
void beginFrame(IEventFrameExecution frame)
endFrame()
and #end()
.
If an event frame is already active in another thread, this method blocks until the other frame ends.
frame
- the frame identifier
IllegalStateException
- if this is called more than once before
endFrame()
is calledvoid flushFrame()
void endFrame()
beginFrame(IEventFrameExecution)
).
void addEvent(IEvent event)
endFrame()
is executed.
If this method is executed outside of an event frame or at the same time
as the event frame thread is executing the endFrame()
, the event
becomes part of the next event frame's unit of work.
There is no stipulation on the ordering of the stored events nor is there any stipulation regarding coalescing of events.
event
- the eventboolean isFrameActive()
true
if an event frame is currently active (started)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |