groovyx.gpars.actor
Class ReactiveActor

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.AbstractLoopingActor
                  extended by groovyx.gpars.actor.ReactiveActor
All Implemented Interfaces:
java.io.Serializable

public class ReactiveActor
extends AbstractLoopingActor

An actor representing a reactor. When it receives a message, the supplied block of code is run with the message as a parameter and the result of the code is send in reply.

 final def doubler = reactor {message ->
     2 * message
 }*
 def result = doubler.sendAndWait(10)
 

Author:
Vaclav Pech, Alex Tkachman Date: Jun 26, 2009
See Also:
Serialized Form

Nested Class Summary
 
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 static long serialVersionUID
           
 
Fields inherited from class groovyx.gpars.actor.AbstractLoopingActor
terminatingFlag
 
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
ReactiveActor(groovy.lang.Closure body)
           
 
Method Summary
 
Methods inherited from class groovyx.gpars.actor.AbstractLoopingActor
getCore, 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, sendAndPromise, 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

serialVersionUID

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

ReactiveActor

public ReactiveActor(groovy.lang.Closure body)

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