cz.cuni.amis.pogamut.multi.communication.worldview.impl
Class BatchAwareSharedWorldView
java.lang.Object
cz.cuni.amis.pogamut.multi.communication.worldview.impl.AbstractSharedWorldView
cz.cuni.amis.pogamut.multi.communication.worldview.impl.EventDrivenSharedWorldView
cz.cuni.amis.pogamut.multi.communication.worldview.impl.BatchAwareSharedWorldView
- All Implemented Interfaces:
- IComponent, ISharedComponent, ISharedWorldChangeEventInput, ISharedWorldView
public abstract class BatchAwareSharedWorldView
- extends EventDrivenSharedWorldView
SharedWorldView with batch-driven implementation.
The worldView manages all its localWorldViews and will notify them after a batch has been fully processed from all worldViews
thus preventing inconsistency in shared data.
LocalWorldViews must notify this worldView with correct events (SharedBatchBeginEvent
and batchEndEvents which are left for the user to override
-> the UT2004 version has its own implementation in descendant worldview )
the sharedWorldView will then notify back with SharedBatchFinishedEvent
when all events have been processed.
- Author:
- srlok
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 |
Methods inherited from class cz.cuni.amis.pogamut.multi.communication.worldview.impl.EventDrivenSharedWorldView |
addMsgClass, innerNotify, objectCreated, objectDestroyed, objectUpdated, propertyCreated, propertyUpdated, propertyUpdatedEvent, raiseEvent, sharedObjectUpdatedEvent, staticObjectUpdatedEvent |
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 |
BatchAwareSharedWorldView
public BatchAwareSharedWorldView(Logger logger)
- Construtor - all we need is logger. Shared world view gets all other information at runtime.
- Parameters:
logger
-
isBatchEndEvent
protected abstract boolean isBatchEndEvent(IWorldChangeEvent event)
notifyLocalWorldViews
protected void notifyLocalWorldViews(Set<IAgentId> waiting,
long time)
- Notifies all waiting local world views, that batch belonging to 'time' has been exported by all local world views.
I.e.
SharedBatchBeginEvent
occurs for 'time'.
- Parameters:
waiting
- agent which local wvs should be notifiedtime
- time for which the batch has finished
processBeginEvent
protected void processBeginEvent(SharedBatchBeginEvent event)
- Adds a lock for the desired time.
This method is called when a SharedBatchBeginEvent is recieved, it means that the localWorldViews should wait
until the entire batch has been processed.
- Parameters:
time
-
processEndEvent
protected void processEndEvent(IWorldChangeEvent event)
- Processes batch-end event ... correctly synchronize access to timeLocks in lock-free manner.
- Parameters:
time
-
notify
public void notify(IWorldChangeEvent event)
- Specified by:
notify
in interface ISharedWorldChangeEventInput
- Overrides:
notify
in class EventDrivenSharedWorldView
Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.