groovyx.gpars.dataflow.operator
Class PoisonTrackCounter

java.lang.Object
  extended by groovyx.gpars.dataflow.operator.PoisonTrackCounter

final class PoisonTrackCounter
extends java.lang.Object

A helper class used by poison messages to count terminated dataflow processors

Author:
Vaclav Pech

Field Summary
private  java.util.concurrent.atomic.AtomicInteger counter
           
private  DataflowVariable<java.lang.Boolean> termination
           
 
Constructor Summary
PoisonTrackCounter(int count)
           
 
Method Summary
(package private)  void countDown()
           
 Promise<java.lang.Boolean> getTermination()
           
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

termination

private final DataflowVariable<java.lang.Boolean> termination

counter

private final java.util.concurrent.atomic.AtomicInteger counter
Constructor Detail

PoisonTrackCounter

PoisonTrackCounter(int count)
Method Detail

join

public void join()
          throws java.lang.InterruptedException
Blocks until the number of terminated operators reaches the number specified in the constructor

Throws:
java.lang.InterruptedException - If the current thread gets interrupted during the blocking

join

public void join(long timeout,
                 java.util.concurrent.TimeUnit unit)
          throws java.lang.InterruptedException
Blocks until the number of terminated operators reaches the number specified in the constructor

Parameters:
timeout - the maximum time to wait
unit - the time unit of the timeout argument
Throws:
java.lang.InterruptedException - If the current thread gets interrupted during the blocking

getTermination

public Promise<java.lang.Boolean> getTermination()

countDown

void countDown()

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