|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.amis.pogamut.multi.communication.worldview.impl.AbstractSharedWorldView
cz.cuni.amis.pogamut.multi.communication.worldview.impl.EventDrivenSharedWorldView
public abstract class EventDrivenSharedWorldView
SharedWorldView implementing basic event management (notyfying listeners --- not yet fully functional)
and updating shared objects using the events. While some synchronization is done here, this worlview does not consider
the events to come in batches and thus may create incosistent data structures. (this is addressed by BatchAwareSharedWorldView
)
Field Summary | |
---|---|
protected PriorityBlockingQueue<IWorldChangeEvent> |
notifyEventsList
List of events we have to process. |
protected boolean |
receiveEventProcessing
Flag that is telling us whether there is an event being processed or not. |
protected Collection<IWorldChangeEvent> |
syncEventList
|
static String |
WORLDVIEW_DEPENDENCY
|
Fields inherited from class cz.cuni.amis.pogamut.multi.communication.worldview.impl.AbstractSharedWorldView |
---|
COMPONENT_ID, control, controller, currentSharedProperties, idClassMap, localWorldViews, log, sharedProperties, sharedWorldObjects, staticWorldObjects, syncCurrentSharedProperties, syncIdClassMap, syncSharedProperties, syncSharedWorldObjects |
Constructor Summary | |
---|---|
EventDrivenSharedWorldView(Logger logger)
|
Method Summary | |
---|---|
void |
addMsgClass(WorldObjectId id,
Class msgClass)
|
protected void |
innerNotify(IWorldChangeEvent event)
Used to process IWorldChangeEvent - it has to be either IWorldChangeEvent or IWorldObjectUpdateEvent. |
void |
notify(IWorldChangeEvent event)
|
protected void |
objectCreated(ISharedWorldObject obj,
long time)
Must be called whenever an object was created, raises correct events. |
protected void |
objectDestroyed(IWorldObject obj,
long time)
Must be called whenever an object was destroyed - raises correct events. |
protected void |
objectUpdated(ITeamId teamId,
WorldObjectId objectId,
long time)
Must be called whenever an object was updated - raises correct event. |
protected void |
propertyCreated(ISharedProperty property,
ITeamId team)
If team is null, the property will be created for all teams. |
protected void |
propertyUpdated(ISharedProperty property,
ITeamId team)
Updates the property. |
protected void |
propertyUpdatedEvent(ISharedPropertyUpdatedEvent event)
MUST NOT BE CALLED CONCURRENTLY - SINGLE THREAD AT THIS POINT ONLY! |
protected void |
raiseEvent(IWorldEvent event)
Catches exceptions. |
protected void |
sharedObjectUpdatedEvent(ISharedWorldObjectUpdatedEvent updateEvent)
Called from EventDrivenWorldView.innerNotify(IWorldChangeEvent) if the event is IWorldObjectUpdatedEvent
to process it. |
protected void |
staticObjectUpdatedEvent(IStaticWorldObjectUpdatedEvent event)
Manages updating static objects, only possible event types are CREATED and DESTROYED, any other event type raises an exception. |
Methods inherited from class cz.cuni.amis.pogamut.multi.communication.worldview.impl.AbstractSharedWorldView |
---|
addComponentBus, addEventListener, addObjectListener, addObjectListener, addObjectListener, addObjectListener, addOldSharedProperty, addSharedProperty, addSharedProperty, addSharedWorldObject, addStaticWorldObject, cleanUp, createSharedObject, getComponentId, getShared, getSharedProperties, getSharedProperty, getStatic, isListening, isListening, isListening, isListening, isListening, isListening, isPaused, isRunning, kill, pause, prePause, preStop, registerLocalWorldView, removeComponentBus, removeEventListener, removeListener, removeObjectListener, removeObjectListener, removeObjectListener, removeObjectListener, removeSharedProperty, removeSharedProperty, removeStaticWorldObject, removeStaticWorldObject, reset, resume, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String WORLDVIEW_DEPENDENCY
protected boolean receiveEventProcessing
It is managed only by notify() method - DO NOT MODIFY OUTSIDE IT!
protected PriorityBlockingQueue<IWorldChangeEvent> notifyEventsList
It is managed only by notify() method - DO NOT MODIFY OUTSIDE IT!
protected Collection<IWorldChangeEvent> syncEventList
Constructor Detail |
---|
public EventDrivenSharedWorldView(Logger logger)
Method Detail |
---|
public void notify(IWorldChangeEvent event) throws ComponentNotRunningException, ComponentPausedException
ComponentNotRunningException
ComponentPausedException
protected void innerNotify(IWorldChangeEvent event)
DO NOT CALL SEPARATELY - should be called only from notifyEvent().
You may override it to provide event-specific processing behavior.
MUST NOT BE CALLED CONCURRENTLY - SINGLE THREAD AT THIS POINT ONLY! MUST BE ENFORCED FROM THE OUTSIDE!
event
- protected void raiseEvent(IWorldEvent event)
ComponentController
.fatalError() and this.kill().
raiseEvent
in class AbstractSharedWorldView
public void addMsgClass(WorldObjectId id, Class msgClass)
protected void sharedObjectUpdatedEvent(ISharedWorldObjectUpdatedEvent updateEvent)
EventDrivenWorldView.innerNotify(IWorldChangeEvent)
if the event is IWorldObjectUpdatedEvent
to process it.
MUST NOT BE CALLED CONCURRENTLY - SINGLE THREAD AT THIS POINT ONLY! MUST BE ENFORCED FROM THE OUTSIDE!
updateEvent
- protected void propertyUpdatedEvent(ISharedPropertyUpdatedEvent event)
event
- protected void staticObjectUpdatedEvent(IStaticWorldObjectUpdatedEvent event)
MUST NOT BE CALLED CONCURRENTLY - SINGLE THREAD AT THIS POINT ONLY! MUST BE ENFORCED FROM THE OUTSIDE!
event
- protected void propertyCreated(ISharedProperty property, ITeamId team)
MUST NOT BE CALLED CONCURRENTLY - SINGLE THREAD AT THIS POINT ONLY! MUST BE ENFORCED FROM THE OUTSIDE!
property
- team
- protected void propertyUpdated(ISharedProperty property, ITeamId team)
MUST NOT BE CALLED CONCURRENTLY - SINGLE THREAD AT THIS POINT ONLY! MUST BE ENFORCED FROM THE OUTSIDE!
property
- team
- protected void objectCreated(ISharedWorldObject obj, long time)
Might be overridden to provide different behavior.
MUST NOT BE CALLED CONCURRENTLY - SINGLE THREAD AT THIS POINT ONLY! MUST BE ENFORCED FROM THE OUTSIDE!
obj
- protected void objectUpdated(ITeamId teamId, WorldObjectId objectId, long time)
Might be overridden to provide a mechanism that will forbid update of certain objects (like items that can't move).
MUST NOT BE CALLED CONCURRENTLY - SINGLE THREAD AT THIS POINT ONLY! MUST BE ENFORCED FROM THE OUTSIDE!
obj
- protected void objectDestroyed(IWorldObject obj, long time)
Might be overriden to provide different behavior.
MUST NOT BE CALLED CONCURRENTLY - SINGLE THREAD AT THIS POINT ONLY! MUST BE ENFORCED FROM THE OUTSIDE!
obj
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |