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 ExecutorServiceprivate final BlockingQueue<IMessagePublication> Fields inherited from class AbstractPubSubSupport
ERROR_HANDLER_MSG -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractSyncAsyncMessageBus(IBusConfiguration configuration) -
Method Summary
Modifier and TypeMethodDescriptionprotected IMessagePublicationaddAsynchronousPublication(MessagePublication publication) protected IMessagePublicationaddAsynchronousPublication(MessagePublication publication, long timeout, TimeUnit unit) protected voidfinalize()booleanCheck whether any asynchronous message publications are pending to be processedprivate voidinitDispatcherThreads(Feature.AsynchronousMessageDispatch configuration) voidshutdown()Shutdown the bus such that it will stop delivering asynchronous messages.Methods inherited from class AbstractPubSubSupport
createMessagePublication, getPublicationFactory, getRegisteredErrorHandlers, getRuntime, getSubscriptionsByMessageType, handlePublicationError, subscribe, toString, unsubscribeMethods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ErrorHandlingSupport
getRegisteredErrorHandlersMethods inherited from interface IMessageBus
postMethods inherited from interface PubSubSupport
publish, subscribe, unsubscribeMethods inherited from interface 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:IMessageBusShutdown 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:
shutdownin interfaceIMessageBus<T, P extends ISyncAsyncPublicationCommand>
-
hasPendingMessages
public boolean hasPendingMessages()Description copied from interface:IMessageBusCheck whether any asynchronous message publications are pending to be processed- Specified by:
hasPendingMessagesin interfaceIMessageBus<T, P extends ISyncAsyncPublicationCommand>- Returns:
- true if any unfinished message publications are found
-