groovyx.gpars.actor
[Java] Class DynamicDispatchActor
java.lang.Object
groovyx.gpars.serial.WithSerialId
groovyx.gpars.actor.impl.MessageStream
groovyx.gpars.actor.Actor
groovyx.gpars.actor.AbstractLoopingActor
groovyx.gpars.actor.DynamicDispatchActor
@java.lang.SuppressWarnings* @return This actor to allow for method chaining
public class DynamicDispatchActor
extends AbstractLoopingActor
A pooled actor allowing for an alternative structure of the message handling code.
In general DynamicDispatchActor repeatedly scans for messages and dispatches arrived messages to one
of the onMessage(message) methods defined on the actor.
final class MyActor extends DynamicDispatchActor {* void onMessage(String message) {* println 'Received string'
}* void onMessage(Integer message) {* println 'Received integer'
}* void onMessage(Object message) {* println 'Received object'
}* void onMessage(NullObject nullMessage) {* println 'Received null'
}*}
Method when {...} provides an alternative way to define message handlers
- Authors:
- Vaclav Pech, Alex Tkachman, Dierk Koenig
Date: Jun 26, 2009
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 |
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, sendAndPromise, setParallelGroup, silentStart, start, stop, sweepNextMessage, sweepQueue, terminate, threadBoundActor |
serialVersionUID
private static final long serialVersionUID
-
DynamicDispatchActor
public DynamicDispatchActor()
-
become
public final DynamicDispatchActor become(groovy.lang.Closure closure)
-
when
public final void when(groovy.lang.Closure closure)
-
Copyright © 2008–2013 Václav Pech. All Rights Reserved.