Package io.smallrye.common.annotation
Annotation Type 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.
When this annotation is used on a class, all the methods declared by the annotated class are considered
blocking.
This annotation is not inheritable, so the user must repeat the annotation when sub-classing the class or overriding the method.
- See Also: