Package net.engio.mbassy.bus
Class AbstractSyncAsyncMessageBus<T,P extends ISyncAsyncPublicationCommand>
java.lang.Object
net.engio.mbassy.bus.AbstractPubSubSupport<T>
net.engio.mbassy.bus.AbstractSyncAsyncMessageBus<T,P>
- Type Parameters:
T
- The type of message this bus consumesP
- The publication commands this bus supports depend on P
- All Implemented Interfaces:
ErrorHandlingSupport
,GenericMessagePublicationSupport<T,
,P> IMessageBus<T,
,P> PubSubSupport<T>
,RuntimeProvider
- Direct Known Subclasses:
MBassador
public abstract class AbstractSyncAsyncMessageBus<T,P extends ISyncAsyncPublicationCommand>
extends AbstractPubSubSupport<T>
implements IMessageBus<T,P>
The base class for all message bus implementations with support for asynchronous message dispatch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ExecutorService
private final BlockingQueue
<IMessagePublication> Fields inherited from class net.engio.mbassy.bus.AbstractPubSubSupport
ERROR_HANDLER_MSG
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractSyncAsyncMessageBus
(IBusConfiguration configuration) -
Method Summary
Modifier and TypeMethodDescriptionprotected IMessagePublication
addAsynchronousPublication
(MessagePublication publication) protected IMessagePublication
addAsynchronousPublication
(MessagePublication publication, long timeout, TimeUnit unit) protected void
finalize()
boolean
Check whether any asynchronous message publications are pending to be processedprivate void
initDispatcherThreads
(Feature.AsynchronousMessageDispatch configuration) void
shutdown()
Shutdown the bus such that it will stop delivering asynchronous messages.Methods inherited from class net.engio.mbassy.bus.AbstractPubSubSupport
createMessagePublication, getPublicationFactory, getRegisteredErrorHandlers, getRuntime, getSubscriptionsByMessageType, handlePublicationError, subscribe, toString, unsubscribe
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.engio.mbassy.bus.common.ErrorHandlingSupport
getRegisteredErrorHandlers
Methods inherited from interface net.engio.mbassy.bus.common.IMessageBus
post
Methods inherited from interface net.engio.mbassy.bus.common.PubSubSupport
publish, subscribe, unsubscribe
Methods inherited from interface net.engio.mbassy.bus.common.RuntimeProvider
getRuntime
-
Field Details
-
executor
-
dispatchers
-
pendingMessages
-
-
Constructor Details
-
AbstractSyncAsyncMessageBus
-
-
Method Details
-
initDispatcherThreads
-
addAsynchronousPublication
-
addAsynchronousPublication
protected IMessagePublication addAsynchronousPublication(MessagePublication publication, long timeout, TimeUnit unit) -
finalize
-
shutdown
public void shutdown()Description copied from interface:IMessageBus
Shutdown the bus such that it will stop delivering asynchronous messages. Executor service and other internally used threads will be shutdown gracefully. After calling shutdown it is not safe to further use the message bus.- Specified by:
shutdown
in interfaceIMessageBus<T,
P extends ISyncAsyncPublicationCommand>
-
hasPendingMessages
public boolean hasPendingMessages()Description copied from interface:IMessageBus
Check whether any asynchronous message publications are pending to be processed- Specified by:
hasPendingMessages
in interfaceIMessageBus<T,
P extends ISyncAsyncPublicationCommand> - Returns:
- true if any unfinished message publications are found
-