Annotation Type Async


@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.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Which kind of thread.
    The executor to run on, configured as cn1.task.executor.<name>.*.
  • Element Details

    • value

      String value
      The executor to run on, configured as cn1.task.executor.<name>.*. Empty means default.
      Default:
      ""
    • thread

      ThreadKind thread
      Which kind of thread.
      Default:
      PLATFORM