@Documented @Target(value=METHOD) @Retention(value=RUNTIME) public @interface Async
Add this annotation to the method you want to execute asynchronously.
Methods of return type void
and Future
are supported. In the latter case, an actual asynchronous Future will be
returned, but the target method should return a temporary Future
that passes the value through as the return type needs to be the same.
Usage with other return types may cause unexpected behavior (because
NULL
will always be returned).
Keep in mind that there is a limited number of threads working with
methods annotated with @Async
. Thus, if one of your
methods keep a thread busy for a long time, others will wait. Try to
make all methods fast, when you annotate them with @Async
.
Copyright © 2012–2017 jcabi.com. All rights reserved.