Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
@Retention(CLASS) @Target({METHOD, TYPE})
public @interface Async
Runs this method on another thread; the caller returns at once.
The method returns void, or a java.util.concurrent.Future – typically
com.codename1.backend.AsyncResult.of(value) – which the caller receives
immediately and which completes when the work does. Anything else is a build
error, because a caller could not receive it.
The build rewrites the compiled method so that it packages its arguments into
a task and hands the task to the named executor; there is no proxy, so this
works however the method is called. An exception from a void method is
logged and recorded on the current span, since nobody is waiting for it.
Methods
public abstract String value() default "" | The executor to run on, configured as cn1.task.executor.<name>.*. |
public abstract ThreadKind thread() default ThreadKind.PLATFORM | Which kind of thread. |
Method details
value
public abstract String value() default ""cn1.task.executor.<name>.*.
Empty means default.thread
public abstract ThreadKind thread() default ThreadKind.PLATFORM