org.apache.commons.test.concurrent
Class RendezvousBarrier
java.lang.Object
org.apache.commons.test.concurrent.RendezvousBarrier
- public class RendezvousBarrier
- extends java.lang.Object
Simple barrier that blocks until all parties have either called or have arrived at the meeting point.
Very useful for testing that require to make concurrent settings deterministic.
- Version:
- $Revision: 155470 $
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 java.lang.String name
count
protected int count
timeout
protected long timeout
RendezvousBarrier
public RendezvousBarrier(java.lang.String name)
RendezvousBarrier
public RendezvousBarrier(java.lang.String name,
long timeout)
RendezvousBarrier
public RendezvousBarrier(java.lang.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 java.lang.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:
java.lang.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 . All Rights Reserved.