@Internal public interface

Barrier

com.atlassian.jira.concurrent.Barrier

@Internal

This interface is an internal implementation detail and will change without notice.

Clients that depend on @Internal classes and interfaces can not expect to be compatible with any version other than the version they were compiled against (even minor version and milestone releases may break binary compatibility with respect to @Internal elements).

Class Overview

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.

Summary

Public Methods
void await()
Blocks the calling thread until the barrier is lowered or the calling thread is interrupted.
void lower()
Lowers the barrier.
void lowerThenRaise()
Lower the barrier to allow waiting threads through, then immediately raise it again.
String name()
Returns this barrier's name.
void raise()
Raises the barrier.

Public Methods

public void await ()

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

public void lower ()

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

public void lowerThenRaise ()

Lower the barrier to allow waiting threads through, then immediately raise it again. Waiting threads are only allowed through once. This is useful for stepping through loops containing a barrier.

public String name ()

Returns this barrier's name.

Returns
  • a String containing the barrier's name

public void raise ()

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