public class QueueInvokingReceiver extends InvokingReceiver implements java.lang.Runnable
MethodExecutor.ExecutableMethod
differentiateByArgNo, registeredMethods
executionObject
Constructor and Description |
---|
QueueInvokingReceiver(java.lang.Object executionObject,
java.lang.String methodsName)
Creates a new instance of QueueInvokingReceiver for message methods.
|
Modifier and Type | Method and Description |
---|---|
void |
finalize()
Stops the queue thread and clears the queue.
|
protected void |
invokeNextMessage()
Retrieves one message from queue and invoke the associated method for it.
|
protected void |
processMessage(Message msg,
java.lang.reflect.Method method)
Put the accepted message and the associated method to the queue.
|
void |
run()
Queue invoker processor.
|
acceptMessage
getClassMethods, getDifferentiatingClasses, getDifferentiatingClasses, getMethod, getMethod, getRegisteredMethods
backgroundExecute, backgroundExecute, backgroundExecute, execute, execute, printUsage, printUsage, printUsage
public QueueInvokingReceiver(java.lang.Object executionObject, java.lang.String methodsName) throws java.lang.IllegalArgumentException
executionObject
that have the specified methodsName
and one message argument
(i.e. a class that is a descendant of Message
) are remebered and associated with
their message argument class.
Invoking then uses this fast association to invoke a method specific for the received message
(according to its class).executionObject
- the object on which the message methods are invokedmethodsName
- the name of the methods to inspect (if null, all methods are inspected)java.lang.IllegalArgumentException
- if the supplied execution object is nullpublic void finalize()
finalize
in class java.lang.Object
protected void processMessage(Message msg, java.lang.reflect.Method method)
processMessage
in class InvokingReceiver
msg
- the accepted message (it will be the parameter for the invoked method)method
- the method to invoke on the executionObjectprotected final void invokeNextMessage() throws java.lang.InterruptedException
java.lang.InterruptedException
- if the thread was interrupted in waitingpublic void run()
run
in interface java.lang.Runnable