Top Description Inners Fields Constructors Methods
org.eclipse.jetty.util

public Class Blocker

extends Object
Class Inheritance
Imports
java.io.IOException, .InterruptedIOException, java.util.concurrent.CompletableFuture, .CountDownLatch, java.util.concurrent.locks.Condition, .ReentrantLock, org.eclipse.jetty.util.thread.Invocable, org.slf4j.Logger, .LoggerFactory

Utility class that provides blocking java.lang.Runnable and org.eclipse.jetty.util.Callback instances. These can either be shared (and mutually excluded from concurrent usage) or single usage. The instances are autocloseable and will emit a warning if the instance is not completed within close.

Non shared Runnable

    try(Blocker.Runnable onAction = Blocker.runnable())
    {
        someMethod(onAction);
        onAction.block();
    }

Shared Runnable

    Blocker.SharedRunnable shared = new Blocker.Shared();
    // ...
    try(Blocker.Runnable onAction = shared.runnable())
    {
        someMethod(onAction);
        onAction.block();
    }

Non shared Callback

    try(Blocker.Callback callback = Blocker.callback())
    {
        someMethod(callback);
        callback.block();
    }

Shared Callback

    Blocker.Shared blocker = new Blocker.Shared();
    // ...
    try(Blocker.Callback callback = blocker.callback())
    {
        someMethod(callback);
        callback.block();
    }

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
public static interface
public static class
Blocker.Shared

A shared reusable Blocking source.

Field Summary

Modifier and TypeField and Description
private static final Throwable
private static final Logger
private static final Throwable

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static Blocker.Callback
public static Blocker.Runnable
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ACQUIREDback to summary
private static final Throwable ACQUIRED
LOGback to summary
private static final Logger LOG
SUCCEEDEDback to summary
private static final Throwable SUCCEEDED

Constructor Detail

Blockerback to summary
public Blocker()

Method Detail

callbackback to summary
public static Blocker.Callback callback()
runnableback to summary
public static Blocker.Runnable runnable()
org.eclipse.jetty.util back to summary

public Interface Blocker.Callback

extends Callback, AutoCloseable, Invocable

Field Summary

Inherited from org.eclipse.jetty.util.Callback:
NOOP
Inherited from org.eclipse.jetty.util.thread.Invocable:
__nonBlockingNOOP

Method Summary

Modifier and TypeMethod and Description
public void
public void
close()

Redeclares java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.
Inherited from org.eclipse.jetty.util.Callback:
combinecompleteWithfailedfromfromfromfromfromfromfromfromfromfromfromsucceeded
Inherited from org.eclipse.jetty.util.thread.Invocable:
combinecombinefromgetInvocationTypegetInvocationTypeinvokeNonBlockingisNonBlockingInvocation

Method Detail

blockback to summary
public void block() throws IOException
closeback to summary
public void close()

Redeclares java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Annotations
@Override
org.eclipse.jetty.util back to summary

public Interface Blocker.Runnable

extends Runnable, AutoCloseable, Invocable

Field Summary

Inherited from org.eclipse.jetty.util.thread.Invocable:
__nonBlockingNOOP

Method Summary

Modifier and TypeMethod and Description
public void
public void
close()

Redeclares java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.
Inherited from java.lang.Runnable:
run
Inherited from org.eclipse.jetty.util.thread.Invocable:
combinecombinefromgetInvocationTypegetInvocationTypeinvokeNonBlockingisNonBlockingInvocation

Method Detail

blockback to summary
public void block() throws IOException
closeback to summary
public void close()

Redeclares java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Annotations
@Override
org.eclipse.jetty.util back to summary

public Class Blocker.Shared

extends Object
Class Inheritance

A shared reusable Blocking source.

Field Summary

Modifier and TypeField and Description
private final Blocker.Callback
private final Condition
private Throwable
private final Condition
private final ReentrantLock
private final Blocker.Runnable

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Blocker.Callback
public Blocker.Runnable
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_callbackback to summary
private final Blocker.Callback _callback
_completeback to summary
private final Condition _complete
_completedback to summary
private Throwable _completed
_idleback to summary
private final Condition _idle
_lockback to summary
private final ReentrantLock _lock
_runnableback to summary
private final Blocker.Runnable _runnable

Constructor Detail

Sharedback to summary
public Shared()

Method Detail

callbackback to summary
public Blocker.Callback callback() throws IOException
runnableback to summary
public Blocker.Runnable runnable() throws IOException