org.apache.commons.transaction.util
Class RendezvousBarrier
java.lang.Object
org.apache.commons.transaction.util.RendezvousBarrier
public class RendezvousBarrier
- extends Object
Simple barrier that blocks until all parties have either called or have
arrived at the meeting point. Very useful for testing or other purposes that
require to make concurrent settings deterministic.
- Version:
- $Id: RendezvousBarrier.java 493628 2007-01-07 01:42:48Z joerg $
|
Method Summary |
void |
call()
Notify the barrier that you (the current thread) will not come to the
meeting point. |
void |
meet()
Meet at this barrier. |
void |
reset()
Releases all waiting threads and resets the number of parties already
arrived. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUT
- See Also:
- Constant Field Values
parties
protected final int parties
name
protected final String name
count
protected int count
timeout
protected long timeout
RendezvousBarrier
public RendezvousBarrier(String name)
RendezvousBarrier
public RendezvousBarrier(String name,
long timeout)
RendezvousBarrier
public RendezvousBarrier(String name,
int parties,
long timeout)
call
public void call()
- Notify the barrier that you (the current thread) will not come to the
meeting point. Same thing as
meet(), but does not not let you
wait.
meet
public void meet()
throws InterruptedException
- Meet at this barrier. The current thread will either block when there are
missing parties for this barrier or it is the last one to complete this
meeting and the barrier will release its block. In this case all other
waiting threads will be notified.
- Throws:
InterruptedException - if the current thread is interrupted while waiting
reset
public void reset()
- Releases all waiting threads and resets the number of parties already
arrived.
Copyright © 2004-2007 The Apache Software Foundation. All Rights Reserved.