groovyx.gpars.activeobject
Class InternalActor
java.lang.Object
groovyx.gpars.serial.WithSerialId
groovyx.gpars.actor.impl.MessageStream
groovyx.gpars.actor.Actor
groovyx.gpars.actor.AbstractLoopingActor
groovyx.gpars.activeobject.InternalActor
- All Implemented Interfaces:
- java.io.Serializable
public final class InternalActor
- extends AbstractLoopingActor
Backs active objects and invokes all object's active methods.
- Author:
- Vaclav Pech
- See Also:
- Serialized Form
Constructor Summary |
InternalActor()
Just like DynamicDispatchActor, except that the actual method dispatch is static through the closure passed to the initialize() method. |
Method Summary |
static InternalActor |
create(java.lang.Object groupId)
|
private static java.lang.Object |
handleCurrentMessage(java.lang.Object msg)
|
void |
onMessage(java.lang.Object[] msg)
Handles incoming messages |
(package private) DataflowVariable<java.lang.Object> |
submit(java.lang.Object... args)
A DataflowVariable is passed to the actor, which will bind it once the result is known. |
(package private) java.lang.Object |
submitAndWait(java.lang.Object... args)
A DataflowVariable is passed to the actor, which will bind it once the result is known. |
Methods inherited from class groovyx.gpars.actor.AbstractLoopingActor |
getSender, hasBeenStopped, initialize, isActive, isFair, makeFair, reply, replyIfExists, send, setParallelGroup, setTimeout, silentStart, start, stop, sweepNextMessage, terminate |
Methods inherited from class groovyx.gpars.actor.Actor |
createActorMessage, createRemoteHandle, deregisterCurrentActorWithThread, getJoinLatch, getParallelGroup, handleException, handleInterrupt, handleStart, handleTermination, handleTimeout, isActorThread, join, join, join, join, onStop, registerCurrentActorWithThread, sendAndContinue, threadBoundActor |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
METHOD_NAME_PREFIX
public static final java.lang.String METHOD_NAME_PREFIX
- See Also:
- Constant Field Values
No_ARGS
private static final java.lang.Object[] No_ARGS
InternalActor
public InternalActor()
- Just like DynamicDispatchActor, except that the actual method dispatch is static through the closure passed to the initialize() method.
submit
DataflowVariable<java.lang.Object> submit(java.lang.Object... args)
- A DataflowVariable is passed to the actor, which will bind it once the result is known.
- Parameters:
args
- The method parameters
- Returns:
- A Promise for the real result
submitAndWait
java.lang.Object submitAndWait(java.lang.Object... args)
throws java.lang.Throwable
- A DataflowVariable is passed to the actor, which will bind it once the result is known.
The method blocks waiting for the Promise to hold a value. The value is then returned back to the caller.
- Parameters:
args
- The method parameters
- Returns:
- The result of the internal method as returned when run in the internal actor's context
- Throws:
java.lang.InterruptedException
- If the current thread gets interrupted while waiting for the internal actor to respond
java.lang.Throwable
- If the target method invoked asynchronously throws an exception.
onMessage
public void onMessage(java.lang.Object[] msg)
- Handles incoming messages
- Parameters:
msg
- The message representing the requested method call
handleCurrentMessage
private static java.lang.Object handleCurrentMessage(java.lang.Object msg)
create
public static InternalActor create(java.lang.Object groupId)