groovyx.gpars.actor
Class Actor.RemoteActor

java.lang.Object
  extended by groovyx.gpars.serial.WithSerialId
      extended by groovyx.gpars.actor.impl.MessageStream
          extended by groovyx.gpars.actor.Actor
              extended by groovyx.gpars.actor.Actor.RemoteActor
All Implemented Interfaces:
RemoteSerialized, java.io.Serializable
Enclosing class:
Actor

public static class Actor.RemoteActor
extends Actor
implements RemoteSerialized

See Also:
Serialized Form

Nested Class Summary
static class Actor.RemoteActor.StopActorMsg
           
static class Actor.RemoteActor.TerminateActorMsg
           
 
Nested classes/interfaces inherited from class groovyx.gpars.actor.Actor
Actor.MyRemoteHandle, Actor.RemoteActor
 
Nested classes/interfaces inherited from class groovyx.gpars.actor.impl.MessageStream
MessageStream.RemoteMessageStream, MessageStream.SendTo
 
Field Summary
private  RemoteHost remoteHost
           
private static long serialVersionUID
           
 
Fields inherited from class groovyx.gpars.actor.Actor
ACTOR_HAS_ALREADY_BEEN_STARTED, CANNOT_SEND_REPLIES_NO_SENDER_HAS_BEEN_REGISTERED, currentThread, parallelGroup, START_MESSAGE, STOP_MESSAGE, TERMINATE_MESSAGE, TIMEOUT, TIMEOUT_MESSAGE, timer
 
Fields inherited from class groovyx.gpars.serial.WithSerialId
serialHandle
 
Constructor Summary
Actor.RemoteActor(SerialContext host, DataflowExpression<java.lang.Object> jointLatch)
           
 
Method Summary
protected  boolean hasBeenStopped()
           
 boolean isActive()
          Checks the current status of the Actor.
 MessageStream send(java.lang.Object message)
          Send message to stream and return immediately
 Actor silentStart()
          Starts the Actor without sending the START_MESSAGE message to speed the start-up.
 Actor start()
          Starts the Actor and sends it the START_MESSAGE to run any afterStart handlers.
 Actor stop()
          Send message to stop to the Actor.
protected  ActorMessage sweepNextMessage()
          Removes the head of the message queue
 Actor terminate()
          Terminates the Actor.
 
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, sendAndPromise, setParallelGroup, sweepQueue, threadBoundActor
 
Methods inherited from class groovyx.gpars.actor.impl.MessageStream
call, getRemoteClass, leftShift, send, send, sendAndWait, sendAndWait, sendAndWait
 
Methods inherited from class groovyx.gpars.serial.WithSerialId
getOrCreateSerialHandle, writeReplace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

remoteHost

private final RemoteHost remoteHost

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

Actor.RemoteActor

public Actor.RemoteActor(SerialContext host,
                         DataflowExpression<java.lang.Object> jointLatch)
Method Detail

silentStart

public Actor silentStart()
Description copied from class: Actor
Starts the Actor without sending the START_MESSAGE message to speed the start-up. The potential custom afterStart handlers won't be run. No messages can be sent or received before an Actor is started.

Specified by:
silentStart in class Actor
Returns:
same actor

start

public Actor start()
Description copied from class: Actor
Starts the Actor and sends it the START_MESSAGE to run any afterStart handlers. No messages can be sent or received before an Actor is started.

Specified by:
start in class Actor
Returns:
same actor

stop

public Actor stop()
Description copied from class: Actor
Send message to stop to the Actor. The actor will finish processing the current message and all unprocessed messages will be passed to the afterStop method, if such exists. No new messages will be accepted since that point. Has no effect if the Actor is not started.

Specified by:
stop in class Actor
Returns:
same actor

terminate

public Actor terminate()
Description copied from class: Actor
Terminates the Actor. Unprocessed messages will be passed to the afterStop method, if exists. No new messages will be accepted since that point. Has no effect if the Actor is not started.

Specified by:
terminate in class Actor
Returns:
same actor

isActive

public boolean isActive()
Description copied from class: Actor
Checks the current status of the Actor.

Specified by:
isActive in class Actor
Returns:
current status of the Actor.

hasBeenStopped

protected boolean hasBeenStopped()
Specified by:
hasBeenStopped in class Actor

sweepNextMessage

protected ActorMessage sweepNextMessage()
Description copied from class: Actor
Removes the head of the message queue

Specified by:
sweepNextMessage in class Actor
Returns:
The head message, or null, if the message queue is empty

send

public MessageStream send(java.lang.Object message)
Description copied from class: MessageStream
Send message to stream and return immediately

Specified by:
send in class MessageStream
Parameters:
message - message to send
Returns:
always return message stream itself

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