Package org.eclipse.jetty.util
Class Blocker
java.lang.Object
org.eclipse.jetty.util.Blocker
Utility class that provides blocking
Runnable
and 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 Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
static interface
static class
A shared reusable Blocking source. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Blocker.Callback
callback()
static <C> Blocker.Promise<C>
promise()
static Blocker.Runnable
runnable()
-
Constructor Details
-
Blocker
public Blocker()
-
-
Method Details
-
runnable
-
callback
-
promise
-