public class Mediator extends Object implements IMediator
IWorldChangeEvent
from the IWorldChangeEventOutput
passing them to the without any delay.
Note that the mediator **NEEDS** setConsumer(IWorldChangeEventInput)
called in order to be started
by the IComponentBus
.
Ignores IComponentControlHelper.startPaused()
, performs IComponentControlHelper.start()
in both start cases.
Modifier and Type | Field and Description |
---|---|
static cz.cuni.amis.utils.token.Token |
COMPONENT_ID |
protected Object |
threadMutex
Mutex for start synchronization.
|
protected cz.cuni.amis.pogamut.base.communication.mediator.impl.Mediator.Worker |
worker
Worker instance - it implements Runnable interface and is continuously
reading messages from the connection object and passing them to the
receiver.
|
static String |
WORKER_THREAD_NAME_PREFIX
Name prefix for the worker thread and for the logs.
|
protected Thread |
workerThread
Thread of the worker.
|
Constructor and Description |
---|
Mediator(IWorldChangeEventOutput producer,
IComponentBus bus,
IAgentLogger logger)
The object in passed to the constructor (IWorldEventOutput) is world
event producer.
|
Modifier and Type | Method and Description |
---|---|
cz.cuni.amis.utils.token.Token |
getComponentId()
Unique identification of the component.
|
LogCategory |
getLog() |
void |
setConsumer(IWorldChangeEventInput consumer) |
String |
toString() |
public static final cz.cuni.amis.utils.token.Token COMPONENT_ID
public static final String WORKER_THREAD_NAME_PREFIX
protected cz.cuni.amis.pogamut.base.communication.mediator.impl.Mediator.Worker worker
protected Thread workerThread
protected Object threadMutex
@Inject public Mediator(IWorldChangeEventOutput producer, IComponentBus bus, IAgentLogger logger)
The mediator will read events from this producer and pass them to the IWorldEventInput specified during the start() of the mediator.
Note that the mediator **NEEDS** setConsumer(IWorldChangeEventInput)
called in order to be started
by the IComponentBus
.
connection
- messageParser
- commandSerializer
- CommunicationException
public cz.cuni.amis.utils.token.Token getComponentId()
IComponent
getComponentId
in interface IComponent
public LogCategory getLog()
public void setConsumer(IWorldChangeEventInput consumer)
setConsumer
in interface IMediator
Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.