public abstract class InternalMessage
extends org.springframework.context.ApplicationEvent
OmeroContext.publishEvent(ApplicationEvent)
or
OmeroContext.publishMessage(InternalMessage)
. It is currently
assumed that the Spring-configured ApplicationEventMulticaster
will
publish the InternalMessage
in the current Thread
. If a
subclass can properly handle the threaded case, it should set
threadSafe
to true.
Since the the OmeroContext.publishEvent(ApplicationEvent)
does not
allow for an exception, consumers of InternalMessage
subclasses can
throw a MessageException
which will properly handled by the
OmeroContext.publishMessage(InternalMessage)
method. (Users of
OmeroContext.publishEvent(ApplicationEvent)
will have to manually
unwrap the MessageException
.
Note: this class may or may not be useful for the client-side, but it must be
in the common/ package for use by OmeroContext
MessageException
,
OmeroContext
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected boolean |
threadSafe |
Constructor and Description |
---|
InternalMessage(java.lang.Object source)
Sole constructor which takes the "source" of this
EventObject . |
Modifier and Type | Method and Description |
---|---|
boolean |
isThreadSafe()
Returns true if this message can safely be passed to another
Thread . |