Package io.smallrye.common.annotation
Annotation Type Blocking
-
@Retention(RUNTIME) @Target(METHOD) public @interface Blocking
Annotation used to indicate that the annotated method is inherently blocking and so should not be executed on a non-blockable thread (I/O thread, event loops...).Frameworks can add support for this annotation and offload the work to another thread if the current thread cannot be blocked. It's particularly useful for frameworks using a reactive execution model. Framework relying on this annotation must specify the exact behavior:
- what thread is considered non-blockable;
- on which thread is the execution offloaded;
- whether, when the current thread can block, the execution of the annotated method is still offloaded to another thread, or stays on the same thread;
- if the execution of the method is offloaded, whether the initial thread is restored after the method execution.
This annotation is not inheritable, so the user must repeat the annotation when overriding the method.
- See Also:
NonBlocking