groovyx.gpars.actor.impl
Class RunnableBackedBlockingActor

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.impl.ReplyingMessageStream
                  extended by groovyx.gpars.actor.impl.SequentialProcessingActor
                      extended by groovyx.gpars.actor.BlockingActor
                          extended by groovyx.gpars.actor.impl.RunnableBackedBlockingActor
All Implemented Interfaces:
java.io.Serializable, java.lang.Runnable

public class RunnableBackedBlockingActor
extends BlockingActor

Utility class to implement a blocking actor backed by any Runnable (including Closure)

Author:
Alex Tkachman, Vaclav Pech
See Also:
Serialized Form

Nested Class Summary
private static class RunnableBackedBlockingActor.RunnableBackedPooledActorDelegate
           
 
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  java.lang.Runnable action
           
private static long serialVersionUID
           
 
Fields inherited from class groovyx.gpars.actor.BlockingActor
AN_ACTOR_CAN_ONLY_RECEIVE_ONE_MESSAGE_AT_A_TIME
 
Fields inherited from class groovyx.gpars.actor.impl.SequentialProcessingActor
S_ACTIVE_MASK, S_FINISHED_MASK, S_FINISHING_MASK, S_NOT_STARTED, S_RUNNING, S_STOP_TERMINATE_MASK, S_STOPPED, S_STOPPING, S_TERMINATED, S_TERMINATING, stopFlag, stopFlagUpdater
 
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
RunnableBackedBlockingActor(java.lang.Runnable handler)
           
 
Method Summary
protected  void act()
          This method represents the body of the actor.
protected  void setAction(java.lang.Runnable handler)
           
 
Methods inherited from class groovyx.gpars.actor.BlockingActor
handleStart, receive, receive, receive, receiveImpl, receiveImpl
 
Methods inherited from class groovyx.gpars.actor.impl.SequentialProcessingActor
handleTermination, hasBeenStopped, checkStopTerminate, isActive, pollMessage, receive, receive, receive, run, send, setParallelGroup, silentStart, start, stop, sweepNextMessage, takeMessage, takeMessage, terminate
 
Methods inherited from class groovyx.gpars.actor.impl.ReplyingMessageStream
getSender, reply, replyIfExists, setSender
 
Methods inherited from class groovyx.gpars.actor.Actor
createActorMessage, createRemoteHandle, deregisterCurrentActorWithThread, getJoinLatch, getParallelGroup, handleException, handleInterrupt, handleTimeout, isActorThread, join, join, join, join, onStop, registerCurrentActorWithThread, sendAndContinue, sendAndPromise, threadBoundActor
 
Methods inherited from class groovyx.gpars.actor.impl.MessageStream
call, getRemoteClass, leftShift, reInterrupt, 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

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

action

private java.lang.Runnable action
Constructor Detail

RunnableBackedBlockingActor

public RunnableBackedBlockingActor(java.lang.Runnable handler)
Method Detail

setAction

protected final void setAction(java.lang.Runnable handler)

act

protected final void act()
Description copied from class: SequentialProcessingActor
This method represents the body of the actor. It is called upon actor's start and can exit either normally by return or due to actor being stopped through the stop() method, which cancels the current actor action. Provides an extension point for subclasses to provide their custom Actor's message handling code.

Specified by:
act in class SequentialProcessingActor

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