Package net.engio.mbassy.bus
Class MessagePublication
- java.lang.Object
-
- net.engio.mbassy.bus.MessagePublication
-
- All Implemented Interfaces:
IMessagePublication
public class MessagePublication extends java.lang.Object implements IMessagePublication
A message publication is created for each asynchronous message dispatch. It reflects the state of the corresponding message publication process, i.e. provides information whether the publication was successfully scheduled, is currently running etc. A message publication lives within a single thread. It is not designed in a thread-safe manner -> not eligible to be used in multiple threads simultaneously .
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMessagePublication.Factoryprivate static classMessagePublication.State
-
Field Summary
Fields Modifier and Type Field Description private booleandispatchedprivate PublicationErrorerrorprivate java.lang.Objectmessageprivate BusRuntimeruntimeprivate MessagePublication.Statestateprivate java.util.Collection<Subscription>subscriptions
-
Constructor Summary
Constructors Modifier Constructor Description protectedMessagePublication(BusRuntime runtime, java.util.Collection<Subscription> subscriptions, java.lang.Object message, MessagePublication.State initialState)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(Subscription subscription)voidexecute()PublicationErrorgetError()java.lang.ObjectgetMessage()booleanhasError()booleanisDeadMessage()booleanisFilteredMessage()booleanisFinished()booleanisRunning()booleanisScheduled()voidmarkDispatched()voidmarkError(PublicationError error)MessagePublicationmarkScheduled()
-
-
-
Field Detail
-
subscriptions
private final java.util.Collection<Subscription> subscriptions
-
message
private final java.lang.Object message
-
state
private volatile MessagePublication.State state
-
dispatched
private volatile boolean dispatched
-
runtime
private final BusRuntime runtime
-
error
private PublicationError error
-
-
Constructor Detail
-
MessagePublication
protected MessagePublication(BusRuntime runtime, java.util.Collection<Subscription> subscriptions, java.lang.Object message, MessagePublication.State initialState)
-
-
Method Detail
-
add
public boolean add(Subscription subscription)
-
execute
public void execute()
- Specified by:
executein interfaceIMessagePublication
-
isFinished
public boolean isFinished()
- Specified by:
isFinishedin interfaceIMessagePublication
-
isRunning
public boolean isRunning()
- Specified by:
isRunningin interfaceIMessagePublication
-
isScheduled
public boolean isScheduled()
- Specified by:
isScheduledin interfaceIMessagePublication
-
hasError
public boolean hasError()
- Specified by:
hasErrorin interfaceIMessagePublication
-
getError
public PublicationError getError()
- Specified by:
getErrorin interfaceIMessagePublication
-
markDispatched
public void markDispatched()
-
markError
public void markError(PublicationError error)
-
markScheduled
public MessagePublication markScheduled()
-
isDeadMessage
public boolean isDeadMessage()
- Specified by:
isDeadMessagein interfaceIMessagePublication
-
isFilteredMessage
public boolean isFilteredMessage()
- Specified by:
isFilteredMessagein interfaceIMessagePublication
-
getMessage
public java.lang.Object getMessage()
- Specified by:
getMessagein interfaceIMessagePublication
-
-