|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object fulmine.AbstractLifeCycle fulmine.model.component.AbstractComponent fulmine.model.container.AbstractContainer fulmine.model.container.AbstractEventProcessingContainer
public abstract class AbstractEventProcessingContainer
An extended AbstractContainer
that includes logic to handle event
processing.
This implementation is thread safe. Events received by
addEvent(IEvent)
are cloned (if they are an
AbstractCloneableComponent
) and cached in a local collection until
the event frame is flushed (see IEventFrame
). The event sinking
process is thread safe. If any of the events are fields of this
container, they are marked for writing when the
AbstractComponent.writeState(IOperationScope, IWireIdentity, byte[][], int[], byte[][], int[], boolean)
method executes. This provides a delta change mechanism that overrides the
AbstractContainer
implementation that can only write the complete
image.
Changes to the container are only notified to IEventListener
objects
when the events are processed via AbstractContainer.endFrame()
. When the events are
processed, the container also raises itself as an event. However, the
container raises a clone of itself. The cloned container will be a deep clone
so will represent the state of the container at the moment in time when the
event occurs.
The AbstractContainer.endFrame()
also raises a TxEvent
containing the
byte[]
to with the changes send to remote context instances.
This is a system event so only ISystemEventListener
instances will
receive these.
Events are raised via the FulmineContext.queueEvents(Collection)
method.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class fulmine.model.container.AbstractContainer |
---|
AbstractContainer.ReaderTask |
Nested classes/interfaces inherited from interface fulmine.model.container.IContainer |
---|
IContainer.DataState |
Field Summary | |
---|---|
protected Collection<IEvent> |
events
The events occurring in an event frame. |
Constructor Summary | |
---|---|
AbstractEventProcessingContainer(String nativeContextIdentity,
String identity,
IType type,
IDomain domain,
IFrameworkContext hostContext,
boolean local)
Standard constructor. |
Method Summary | |
---|---|
void |
addEvent(IEvent event)
A synchronous notification implementation |
protected void |
afterAdd(IField field)
Called after the field is added and the copy-on-write operation has completed. |
Object |
clone()
Clone this. |
protected void |
doCommitEvents()
This is thread safe - only the event frame can execute this. |
protected void |
doComponentDestroy()
The destroy method that is invoked on a non-cloned version of this. |
protected void |
doStateChangeOp(IContainer.DataState oldState)
Perform the operation when the AbstractContainer.dataState changes. |
Collection<IField> |
getChangedFields()
Get the fields that have changed in the previous event frame. |
protected Collection<IField> |
getFieldsToWrite(boolean completeState)
Get the fields to write to a frame. |
protected AsyncLog |
getLog()
Get the log to use for the object hierarchy |
Methods inherited from class fulmine.model.component.AbstractComponent |
---|
addListener, checkClone, createIdentityString, doDestroy, getAddress, getAddressable, getDomain, getDrivingFrame, getEventSourceGroupId, getFrame, getIdentity, getIdentityString, getListeners, getSource, getTriggerEvent, getType, isClone, readState, removeListener, removeListeners, setDrivingFrame, setFrame, setTriggerEvent, toIdentityString, writeState |
Methods inherited from class fulmine.AbstractLifeCycle |
---|
checkActive, destroy, finalize, isActive, start |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface fulmine.model.container.IContainer |
---|
destroy, getType, isClone, start |
Methods inherited from interface fulmine.protocol.wire.IWireState |
---|
readState, writeState |
Methods inherited from interface fulmine.event.IEventSource |
---|
addListener, getEventSourceGroupId, getListeners, removeListener, removeListeners |
Methods inherited from interface fulmine.IDescriptor |
---|
toIdentityString |
Methods inherited from interface fulmine.ILifeCycle |
---|
isActive |
Methods inherited from interface fulmine.IAddressable |
---|
getAddress, getDomain, getIdentity |
Methods inherited from interface fulmine.event.IEvent |
---|
getDrivingFrame, getFrame, getSource, getTriggerEvent, setTriggerEvent |
Methods inherited from interface fulmine.IDescriptor |
---|
toIdentityString |
Methods inherited from interface fulmine.IAddressable |
---|
getAddress, getDomain, getIdentity |
Field Detail |
---|
protected volatile Collection<IEvent> events
Constructor Detail |
---|
public AbstractEventProcessingContainer(String nativeContextIdentity, String identity, IType type, IDomain domain, IFrameworkContext hostContext, boolean local)
nativeContextIdentity
- whether the container is local to this contextidentity
- the identity of the containertype
- the type of the containerdomain
- the domain for the containerhostContext
- the context hosting this container instancelocal
- true
the container is local to this contextMethod Detail |
---|
protected final void doCommitEvents()
doCommitEvents
in class AbstractContainer
IEventFrame.endFrame()
public final void addEvent(IEvent event)
AbstractComponent
addEvent
in interface IEventFrame
addEvent
in interface IEventSource
addEvent
in class AbstractComponent
event
- the event to pass on to the registered listenersprotected AsyncLog getLog()
AbstractLifeCycle
getLog
in class AbstractContainer
protected void doComponentDestroy()
AbstractComponent
doComponentDestroy
in class AbstractContainer
protected void afterAdd(IField field)
AbstractContainer
afterAdd
in class AbstractContainer
field
- the field to addpublic final Collection<IField> getChangedFields()
IEventListener.update(IEvent)
method when a listener receives notification that the IContainer
has changed. The notification is a clone of the original and this method
is only usable for cloned instances (hence only within the update
method).
protected Collection<IField> getFieldsToWrite(boolean completeState)
AbstractContainer
#changedFields
field prior to being written to a frame.
getFieldsToWrite
in class AbstractContainer
protected void doStateChangeOp(IContainer.DataState oldState)
AbstractContainer
AbstractContainer.dataState
changes.
doStateChangeOp
in class AbstractContainer
oldState
- the old statepublic Object clone() throws CloneNotSupportedException
IEvent
clone
in interface IEvent
clone
in class AbstractContainer
CloneNotSupportedException
Object#clone)_
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |