CallbackCallback.Completable, Callback.Nested, CompletableCallback, CountingCallback, FutureCallback, IteratingCallback, IteratingNestedCallback, SharedBlockingCallback.Blockerpublic interface Invocable
A task (typically either a Runnable or Callable
that declares how it will behave when invoked:
Static methods and are provided that allow the current thread to be tagged
with a ThreadLocal to indicate if it has a blocking invocation type.
| Modifier and Type | Interface | Description |
|---|---|---|
static class |
Invocable.InvocationType |
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.ThreadLocal<java.lang.Boolean> |
__nonBlocking |
| Modifier and Type | Method | Description |
|---|---|---|
static java.lang.Runnable |
asPreferred(java.lang.Runnable task,
Invocable.InvocationType preferredInvocationType) |
wrap a task with the to indicate invocation type.
|
default Invocable.InvocationType |
getInvocationType() |
|
static Invocable.InvocationType |
getInvocationType(java.lang.Object o) |
Get the invocation type of an Object.
|
static void |
invokeNonBlocking(java.lang.Runnable task) |
Invoke a task with the calling thread, tagged to indicate
that it will not block.
|
static void |
invokePreferNonBlocking(java.lang.Runnable task) |
Invoke a task with the calling thread.
|
static void |
invokePreferred(java.lang.Runnable task,
Invocable.InvocationType preferredInvocationType) |
Invoke a task with the calling thread.
|
static boolean |
isNonBlockingInvocation() |
Test if the current thread has been tagged as non blocking
|
static boolean isNonBlockingInvocation()
static void invokeNonBlocking(java.lang.Runnable task)
task - The task to invoke.static void invokePreferNonBlocking(java.lang.Runnable task)
Invocable of Invocable.InvocationType.EITHER
then it is invoked with invokeNonBlocking(Runnable), to
indicate the type of invocation that has been assumed.task - The task to invoke.static void invokePreferred(java.lang.Runnable task,
Invocable.InvocationType preferredInvocationType)
Invocable of Invocable.InvocationType.EITHER
and the preferredInvocationType is not Invocable.InvocationType.BLOCKING
then it is invoked with invokeNonBlocking(Runnable).task - The task to invoke.preferredInvocationType - The invocation type to use if the task
does not indicate a preference.static java.lang.Runnable asPreferred(java.lang.Runnable task,
Invocable.InvocationType preferredInvocationType)
Invocable of Invocable.InvocationType.EITHER
and the preferredInvocationType is not Invocable.InvocationType.BLOCKING
then it is wrapped with an invocation of invokeNonBlocking(Runnable).
otherwise the task itself is returned.task - The task to invoke.preferredInvocationType - The invocation type to use if the task
does not indicate a preference.static Invocable.InvocationType getInvocationType(java.lang.Object o)
o - The object to check the invocation type of.Invocable, it is coerced and the getInvocationType()
used, otherwise Invocable.InvocationType.BLOCKING is returned.default Invocable.InvocationType getInvocationType()
Copyright © 1995–2017 Webtide. All rights reserved.