Atmosphere/atmosphere — Issue #116: Add support for @Asynchronous annotation for non blocking Jersey resource execution
Author: jfarcand
Created: 2011-12-09 01:13:29+00:00
State: open
Labels: 0.8.2

Add support for a new annotation called @Asynchronous. This annotation's role is to allow execution of asynchronous REST resource. As an example

@Asynchrounous
public String foo() {
return "bar";
}

will asynchronously execute write operation "bar". Logic can also be executed by doing:

@Asynchrounous
public Callable foo() {
return new Callable() {
public String call() {
return foo;
}
}
}

The idea behind the annotation is to allow CPU intensive or long task to be asynchronously executed without blocking the request thread. Atmosphere will take care of detecting which transport is used the best approach to execute the task. The mechanism can be enabled by defining, on the client side, a header telling Atmosphere to execute asynchronously a Jersey method. The annotation can also be used with BroadcastFilter and AtmosphereResourceEventListener to track what's happening.