public class DefaultEventbus extends Eventbus
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
asyncLocalInvocation
Invoke all local listeners via Thread pool (true) or directly (false)
|
protected io.datatree.dom.Cache<java.lang.String,ListenerEndpoint[]> |
broadcasterCache |
protected boolean |
checkVersion
Check protocol version
|
protected io.datatree.dom.Cache<java.lang.String,Strategy<ListenerEndpoint>[]> |
emitterCache |
protected java.util.concurrent.ExecutorService |
executor |
protected java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,Strategy<ListenerEndpoint>>> |
listeners |
protected io.datatree.dom.Cache<java.lang.String,ListenerEndpoint[]> |
localBroadcasterCache |
protected int |
maxCallLevel
Max call level (for nested events)
|
protected java.lang.String |
nodeID
Local Node ID
|
protected java.util.concurrent.locks.Lock |
registryReadLock
Reader lock of the Event Bus
|
protected java.util.concurrent.locks.Lock |
registryWriteLock
Writer lock of the Event Bus
|
protected java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock |
requestStreamReadLock |
protected java.util.HashMap<java.lang.String,IncomingStream> |
requestStreams |
protected java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock |
requestStreamWriteLock |
protected java.util.concurrent.ScheduledExecutorService |
scheduler |
protected ServiceInvoker |
serviceInvoker |
protected StrategyFactory |
strategy |
protected long |
streamTimeout
Stream inactivity/read timeout in MILLISECONDS (0 = no timeout).
|
protected java.util.concurrent.ScheduledFuture<?> |
streamTimeoutTimer
Cancelable timer for request streams
|
protected Transporter |
transporter |
protected UidGenerator |
uidGenerator |
protected boolean |
writeErrorsToLog
Write exceptions into the log file
|
broker, logger, name| Constructor and Description |
|---|
DefaultEventbus() |
DefaultEventbus(boolean asyncLocalInvocation) |
| Modifier and Type | Method and Description |
|---|---|
void |
addListeners(java.lang.String serviceName,
Service service) |
void |
addListeners(java.lang.String nodeID,
io.datatree.Tree config) |
void |
broadcast(Context ctx,
Groups groups,
boolean local) |
protected void |
checkTimeouts() |
void |
emit(Context ctx,
Groups groups,
boolean local) |
io.datatree.Tree |
generateListenerDescriptor(java.lang.String service) |
protected java.lang.String |
getCacheKey(java.lang.String name,
Groups groups) |
int |
getMaxCallLevel() |
long |
getStreamTimeout() |
boolean |
isAsyncLocalInvocation() |
boolean |
isCheckVersion() |
boolean |
isWriteErrorsToLog() |
void |
receiveEvent(io.datatree.Tree message) |
void |
removeListeners(java.lang.String nodeID) |
void |
setAsyncLocalInvocation(boolean asyncLocalInvocation) |
void |
setCheckVersion(boolean checkVersion) |
void |
setMaxCallLevel(int maxCallLevel) |
void |
setStreamTimeout(long streamTimeout) |
void |
setWriteErrorsToLog(boolean writeErrorsToLog) |
void |
started(ServiceBroker broker)
Initializes default EventBus instance.
|
void |
stopped() |
protected void |
stopStreaming(Context ctx) |
getBroker, getLogger, getNameprotected final java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,Strategy<ListenerEndpoint>>> listeners
protected final io.datatree.dom.Cache<java.lang.String,Strategy<ListenerEndpoint>[]> emitterCache
protected final io.datatree.dom.Cache<java.lang.String,ListenerEndpoint[]> broadcasterCache
protected final io.datatree.dom.Cache<java.lang.String,ListenerEndpoint[]> localBroadcasterCache
protected boolean asyncLocalInvocation
protected boolean checkVersion
protected java.lang.String nodeID
protected boolean writeErrorsToLog
protected long streamTimeout
protected int maxCallLevel
protected final java.util.concurrent.locks.Lock registryReadLock
protected final java.util.concurrent.locks.Lock registryWriteLock
protected java.util.concurrent.ScheduledFuture<?> streamTimeoutTimer
protected StrategyFactory strategy
protected Transporter transporter
protected java.util.concurrent.ExecutorService executor
protected ServiceInvoker serviceInvoker
protected java.util.concurrent.ScheduledExecutorService scheduler
protected UidGenerator uidGenerator
protected final java.util.HashMap<java.lang.String,IncomingStream> requestStreams
protected final java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock requestStreamReadLock
protected final java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock requestStreamWriteLock
public DefaultEventbus()
public DefaultEventbus(boolean asyncLocalInvocation)
public void started(ServiceBroker broker) throws java.lang.Exception
started in class MoleculerComponentbroker - parent ServiceBrokerjava.lang.Exceptionpublic void stopped()
stopped in class MoleculerComponentprotected void checkTimeouts()
public void receiveEvent(io.datatree.Tree message)
receiveEvent in class Eventbuspublic void addListeners(java.lang.String serviceName,
Service service)
addListeners in class Eventbuspublic void addListeners(java.lang.String nodeID,
io.datatree.Tree config)
addListeners in class Eventbuspublic void removeListeners(java.lang.String nodeID)
removeListeners in class Eventbusprotected void stopStreaming(Context ctx)
protected java.lang.String getCacheKey(java.lang.String name,
Groups groups)
public io.datatree.Tree generateListenerDescriptor(java.lang.String service)
generateListenerDescriptor in class Eventbuspublic boolean isCheckVersion()
public void setCheckVersion(boolean checkVersion)
public boolean isAsyncLocalInvocation()
public void setAsyncLocalInvocation(boolean asyncLocalInvocation)
public boolean isWriteErrorsToLog()
public void setWriteErrorsToLog(boolean writeErrorsToLog)
public long getStreamTimeout()
public void setStreamTimeout(long streamTimeout)
public int getMaxCallLevel()
public void setMaxCallLevel(int maxCallLevel)