Package eu.bandm.tools.message
Class MessageCatcher
- All Implemented Interfaces:
Runnable
Executes some code (given explicitly as argument) and sends
the first exception caught to its message drain.
The code can either be defined (1) as a
Then call
Caught throwables which are
The code can either be defined (1) as a
Runnable
and
given as constructor argument, or (2) be re-defining code()
in a derived class.Then call
run()
to start execution.Caught throwables which are
Message
s are sent directly to the
MessageReceiver
in SingleSender.receiver
. All other
Exception
are wrapped into a SimpleMessage
of kind
failure
.Error
s are not caught, only Exception
s.-
Field Summary
Modifier and TypeFieldDescriptionlocal cache for the caught exception.The code to executeFields inherited from class eu.bandm.tools.message.SingleSender
receiver
-
Constructor Summary
ConstructorDescriptionWhen using this constructor, you have to re-define the methodcode()
.MessageCatcher
(Runnable c, MessageReceiver<Message> rec) Evident. -
Method Summary
Methods inherited from class eu.bandm.tools.message.SingleSender
getReceiver, send, setReceiver
-
Field Details
-
caught
local cache for the caught exception. -
runnable
The code to execute
-
-
Constructor Details
-
MessageCatcher
Evident.- Parameters:
c
- the code to executerec
- the essage receiver
-
MessageCatcher
When using this constructor, you have to re-define the methodcode()
. Otherwise code will crash intentionally.
-
-
Method Details