com.atlassian.jira.concurrent
Interface Barrier


@Internal
public interface Barrier

The barrier allows us to hold up an operation for a short while. This class is not API and should only be used for testing.

Barriers must be lowered in a finally block so as to avoid blocking operations forever.

Since:
v5.2

Method Summary
 void await()
          Blocks the calling thread until the barrier is lowered or the calling thread is interrupted.
 void lower()
          Lowers the barrier.
 String name()
          Returns this barrier's name.
 void raise()
          Raises the barrier.
 

Method Detail

name

String name()
Returns this barrier's name.

Returns:
a String containing the barrier's name

await

void await()
Blocks the calling thread until the barrier is lowered or the calling thread is interrupted. Callers may use Thread.isInterrupted() to check if the thread has been interrupted.


raise

void raise()
Raises the barrier. Threads that call await() when the barrier is raised will block indefinitely until the barrier is lowered again.


lower

void lower()
Lowers the barrier. Any threads that are blocked on await() will no longer be blocked.



Copyright © 2002-2014 Atlassian. All Rights Reserved.