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 class
MessagePublication.Factory
private static class
MessagePublication.State
-
Field Summary
Fields Modifier and Type Field Description private boolean
dispatched
private PublicationError
error
private java.lang.Object
message
private BusRuntime
runtime
private MessagePublication.State
state
private java.util.Collection<Subscription>
subscriptions
-
Constructor Summary
Constructors Modifier Constructor Description protected
MessagePublication(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 boolean
add(Subscription subscription)
void
execute()
PublicationError
getError()
java.lang.Object
getMessage()
boolean
hasError()
boolean
isDeadMessage()
boolean
isFilteredMessage()
boolean
isFinished()
boolean
isRunning()
boolean
isScheduled()
void
markDispatched()
void
markError(PublicationError error)
MessagePublication
markScheduled()
-
-
-
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:
execute
in interfaceIMessagePublication
-
isFinished
public boolean isFinished()
- Specified by:
isFinished
in interfaceIMessagePublication
-
isRunning
public boolean isRunning()
- Specified by:
isRunning
in interfaceIMessagePublication
-
isScheduled
public boolean isScheduled()
- Specified by:
isScheduled
in interfaceIMessagePublication
-
hasError
public boolean hasError()
- Specified by:
hasError
in interfaceIMessagePublication
-
getError
public PublicationError getError()
- Specified by:
getError
in interfaceIMessagePublication
-
markDispatched
public void markDispatched()
-
markError
public void markError(PublicationError error)
-
markScheduled
public MessagePublication markScheduled()
-
isDeadMessage
public boolean isDeadMessage()
- Specified by:
isDeadMessage
in interfaceIMessagePublication
-
isFilteredMessage
public boolean isFilteredMessage()
- Specified by:
isFilteredMessage
in interfaceIMessagePublication
-
getMessage
public java.lang.Object getMessage()
- Specified by:
getMessage
in interfaceIMessagePublication
-
-