|
org.codehaus.gpars | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovyx.gpars.serial.WithSerialId groovyx.gpars.actor.impl.MessageStream groovyx.gpars.actor.Actor groovyx.gpars.actor.impl.ReplyingMessageStream groovyx.gpars.actor.impl.SequentialProcessingActor
@java.lang.SuppressWarnings*/ public abstract class SequentialProcessingActor extends ReplyingMessageStream
Nested Class Summary | |
---|---|
private static class |
SequentialProcessingActor.Node
|
Field Summary | |
---|---|
private static java.lang.String |
SHOULD_NOT_REACH_HERE
|
protected static int |
S_ACTIVE_MASK
Indicates whether the actor should terminate |
protected static int |
S_FINISHED_MASK
|
protected static int |
S_FINISHING_MASK
|
protected static int |
S_NOT_STARTED
|
protected static int |
S_RUNNING
|
protected static int |
S_STOPPED
|
protected static int |
S_STOPPING
|
protected static int |
S_STOP_TERMINATE_MASK
|
protected static int |
S_TERMINATED
|
protected static int |
S_TERMINATING
|
private SequentialProcessingActor.Node |
inputQueue
|
private static java.util.concurrent.atomic.AtomicReferenceFieldUpdater |
inputQueueUpdater
|
private java.util.concurrent.atomic.AtomicBoolean |
ongoingThreadTermination
|
private SequentialProcessingActor.Node |
outputQueue
|
private static long |
serialVersionUID
|
protected int |
stopFlag
|
protected static java.util.concurrent.atomic.AtomicIntegerFieldUpdater |
stopFlagUpdater
|
private java.lang.Thread |
waitingThread
|
Fields inherited from class ReplyingMessageStream | |
---|---|
sender, serialVersionUID |
Fields inherited from class MessageStream | |
---|---|
serialVersionUID |
Fields inherited from class WithSerialId | |
---|---|
serialHandle, serialVersionUID |
Constructor Summary | |
protected SequentialProcessingActor()
Sets the actor's group. |
Method Summary | |
---|---|
protected void
|
act()
|
private ActorMessage
|
awaitNextMessage(long endTime)
|
protected void
|
checkStopTerminate()
|
protected void
|
handleTermination()
|
protected boolean
|
hasBeenStopped()
|
boolean
|
isActive()
|
protected ActorMessage
|
pollMessage()
|
protected java.lang.Object
|
receive()
|
protected java.lang.Object
|
receive(long timeout, java.util.concurrent.TimeUnit units)
|
protected java.lang.Object
|
receive(groovy.time.BaseDuration duration)
Removes the head of the message queue |
protected java.lang.Object
|
receiveImpl()
Retrieves a message from the message queue, waiting, if necessary, for a message to arrive. |
protected java.lang.Object
|
receiveImpl(long timeout, java.util.concurrent.TimeUnit units)
|
private ActorMessage
|
retrieveNextMessage()
Transfers messages from the input queue into the output queue, reverting the order of the elements. |
void
|
run()
|
MessageStream
|
send(java.lang.Object message)
|
void
|
setParallelGroup(PGroup group)
|
Actor
|
silentStart()
Starts the Actor. |
SequentialProcessingActor
|
start()
Send message to stop to the actor. |
Actor
|
stop()
Terminate the Actor. |
protected ActorMessage
|
sweepNextMessage()
|
protected ActorMessage
|
takeMessage()
|
protected ActorMessage
|
takeMessage(long timeout, java.util.concurrent.TimeUnit timeUnit)
|
Actor
|
terminate()
|
private void
|
throwIfNeeded(ActorMessage toProcess)
|
private void
|
transferQueues()
Creates a new instance, sets the default actor group. |
private static java.lang.Object
|
unwrapMessage(java.lang.Object msg)
|
Methods inherited from class ReplyingMessageStream | |
---|---|
getSender, reply, replyIfExists, setSender |
Methods inherited from class MessageStream | |
---|---|
call, getRemoteClass, leftShift, reInterrupt, send, send, send, sendAndWait, sendAndWait, sendAndWait |
Methods inherited from class WithSerialId | |
---|---|
createRemoteHandle, getOrCreateSerialHandle, getRemoteClass, writeReplace |
Field Detail |
---|
private static final java.lang.String SHOULD_NOT_REACH_HERE
protected static final int S_ACTIVE_MASK
protected static final int S_FINISHED_MASK
protected static final int S_FINISHING_MASK
protected static final int S_NOT_STARTED
protected static final int S_RUNNING
protected static final int S_STOPPED
protected static final int S_STOPPING
protected static final int S_STOP_TERMINATE_MASK
protected static final int S_TERMINATED
protected static final int S_TERMINATING
@java.lang.SuppressWarningsprotected static final int S_ACTIVE_MASK = 1; protected static final int S_FINISHING_MASK = 2; private SequentialProcessingActor.Node inputQueue
private static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater inputQueueUpdater
private final java.util.concurrent.atomic.AtomicBoolean ongoingThreadTermination
private SequentialProcessingActor.Node outputQueue
private static final long serialVersionUID
protected int stopFlag
protected static final java.util.concurrent.atomic.AtomicIntegerFieldUpdater stopFlagUpdater
private java.lang.Thread waitingThread
Constructor Detail |
---|
protected SequentialProcessingActor()
group
- new group
Method Detail |
---|
protected void act()
private ActorMessage awaitNextMessage(long endTime)
protected final void checkStopTerminate()
@java.lang.Override protected void handleTermination()
@java.lang.Overridesuper.handleTermination(); protected final boolean hasBeenStopped()
@java.lang.Overrideif (toProcess == TERMINATE_MESSAGE) { public final boolean isActive()
protected final ActorMessage pollMessage()
protected final java.lang.Object receive()
protected final java.lang.Object receive(long timeout, java.util.concurrent.TimeUnit units)
protected final java.lang.Object receive(groovy.time.BaseDuration duration)
protected java.lang.Object receiveImpl()
protected java.lang.Object receiveImpl(long timeout, java.util.concurrent.TimeUnit units)
private ActorMessage retrieveNextMessage()
@java.lang.OverridestopFlag = S_STOPPING; @java.lang.SuppressWarningsthrow STOP; public void run()
@java.lang.Override} public final MessageStream send(java.lang.Object message)
@java.lang.OverridetoAdd.next = prev; public final void setParallelGroup(PGroup group)
@java.lang.Overridereturn this; public Actor silentStart()
@java.lang.Override public final SequentialProcessingActor start()
@java.lang.Overridewhile (true) { public final Actor stop()
@java.lang.Override* normally by return or due to actor being stopped through the stop() method, which cancels the current protected final ActorMessage sweepNextMessage()
protected final ActorMessage takeMessage()
protected ActorMessage takeMessage(long timeout, java.util.concurrent.TimeUnit timeUnit)
@java.lang.Override} else { public final Actor terminate()
private void throwIfNeeded(ActorMessage toProcess)
private void transferQueues()
private static java.lang.Object unwrapMessage(java.lang.Object msg)
Copyright © 2008–2013 Václav Pech. All Rights Reserved.