org.codehaus.gpars

groovyx.gpars.activeobject
[Java] 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

@SuppressWarnings({"CallToStringEquals"})
public final class InternalActor
extends AbstractLoopingActor

Backs active objects and invokes all object's active methods.

Authors:
Vaclav Pech


Field Summary
static java.lang.String METHOD_NAME_PREFIX

private static Object[] No_ARGS

private static long serialVersionUID

 
Fields inherited from class AbstractLoopingActor
core, currentSender, currentTimerTask, serialVersionUID, stoppedFlag, terminatedFlag, terminatingFlag, timeoutCounter
 
Fields inherited from class Actor
ACTOR_HAS_ALREADY_BEEN_STARTED, AFTER_START, CANNOT_SEND_REPLIES_NO_SENDER_HAS_BEEN_REGISTERED, EMPTY_ARGUMENTS, ON_DELIVERY_ERROR, RESPONDS_TO, START_MESSAGE, STOP_MESSAGE, TERMINATE_MESSAGE, TIMEOUT, TIMEOUT_MESSAGE, currentActorPerThread, currentThread, joinLatch, onStop, parallelGroup, serialVersionUID, timer
 
Fields inherited from class MessageStream
serialVersionUID
 
Fields inherited from class WithSerialId
serialHandle, serialVersionUID
 
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(Object[] msg)

Handles incoming messages

DataflowVariable submit(java.lang.Object args)

A DataflowVariable is passed to the actor, which will bind it once the result is known.

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 AbstractLoopingActor
cancelCurrentTimeoutTask, doStart, getCore, getSender, hasBeenStopped, initialize, isActive, isFair, makeFair, reply, replyIfExists, runEnhancedWithoutRepliesOnMessages, send, setParallelGroup, setTimeout, silentStart, start, stop, sweepNextMessage, terminate
 
Methods inherited from class Actor
callDynamic, createActorMessage, createRemoteHandle, deregisterCurrentActorWithThread, getJoinLatch, getParallelGroup, handleException, handleInterrupt, handleStart, handleTermination, handleTimeout, hasBeenStopped, isActive, isActorThread, join, join, join, join, onStop, registerCurrentActorWithThread, sendAndContinue, setParallelGroup, silentStart, start, stop, sweepNextMessage, sweepQueue, terminate, threadBoundActor
 
Methods inherited from class MessageStream
call, getRemoteClass, leftShift, reInterrupt, send, send, send, sendAndWait, sendAndWait, sendAndWait
 
Methods inherited from class WithSerialId
createRemoteHandle, getOrCreateSerialHandle, getRemoteClass, writeReplace
 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

METHOD_NAME_PREFIX

public static final java.lang.String METHOD_NAME_PREFIX


No_ARGS

private static final Object[] No_ARGS


serialVersionUID

private static final long serialVersionUID


 
Constructor Detail

InternalActor

public InternalActor()
Just like DynamicDispatchActor, except that the actual method dispatch is static through the closure passed to the initialize() method.


 
Method Detail

create

public static InternalActor create(java.lang.Object groupId)


handleCurrentMessage

@SuppressWarnings({"unchecked"})
private static java.lang.Object handleCurrentMessage(java.lang.Object msg)


onMessage

@SuppressWarnings({"unchecked", "MethodMayBeStatic"})
public void onMessage(Object[] msg)
Handles incoming messages
Parameters:
msg - The message representing the requested method call


submit

DataflowVariable 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

@SuppressWarnings({"ProhibitedExceptionDeclared"})
java.lang.Object submitAndWait(java.lang.Object args)
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.
throws:
InterruptedException If the current thread gets interrupted while waiting for the internal actor to respond
throws:
Throwable If the target method invoked asynchronously throws an exception.
Parameters:
args - The method parameters
Returns:
The result of the internal method as returned when run in the internal actor's context


 

Copyright © 2008–2010 Václav Pech. All Rights Reserved.