org.codehaus.gpars

groovyx.gpars.dataflow.operator
[Java] Class ImmediateCountingPoisonPill

java.lang.Object
  groovyx.gpars.dataflow.operator.PoisonPill
      groovyx.gpars.dataflow.operator.ImmediateCountingPoisonPill

public final class ImmediateCountingPoisonPill
extends PoisonPill

Represents an immediate PoisonPill that counts stopped operators and can be used to wait for all the operators to terminate.

Authors:
Vaclav Pech


Field Summary
private PoisonTrackCounter poisonTrackCounter

 
Fields inherited from class PoisonPill
immediate, immediateInstance, ourInstance
 
Constructor Summary
ImmediateCountingPoisonPill(int count)

Creates an immediate instance that could be used to stop operators in a network.

 
Method Summary
void countDown()

Promise getTermination()

Retrieves the promise for termination

void join()

Blocks until the number of terminated operators reaches the number specified in the constructor

void join(long timeout, java.util.concurrent.TimeUnit unit)

Blocks until the number of terminated operators reaches the number specified in the constructor

 
Methods inherited from class PoisonPill
countDown, getImmediateInstance, getInstance, isImmediate
 

Field Detail

poisonTrackCounter

private final PoisonTrackCounter poisonTrackCounter


 
Constructor Detail

ImmediateCountingPoisonPill

public ImmediateCountingPoisonPill(int count)
Creates an immediate instance that could be used to stop operators in a network.
Parameters:
count - The number of operators that need to be stopped before the join() method returns.


 
Method Detail

countDown

@Override
void countDown()


getTermination

public Promise getTermination()
Retrieves the promise for termination
Returns:
A Promise instance that will be bound when all the requested dataflow pocessors have been terminated


join

public void join()
Blocks until the number of terminated operators reaches the number specified in the constructor
throws:
InterruptedException If the current thread gets interrupted during the blocking


join

public void join(long timeout, java.util.concurrent.TimeUnit unit)
Blocks until the number of terminated operators reaches the number specified in the constructor
throws:
InterruptedException If the current thread gets interrupted during the blocking
Parameters:
timeout - the maximum time to wait
unit - the time unit of the timeout argument


 

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