@Documented @Retention(value=RUNTIME) @Target(value=METHOD) @Inherited public @interface UseAsyncMethod
public Future> greetMeAsync(final String requestType,
final AsyncHandler asyncHandler) {
final ServerAsyncResponse r = new ServerAsyncResponse<>();
new Thread() {
public void run() {
//do some work on a backgound thread to generate the response...
GreetMeResponse resp = new GreetMeResponse();
resp.setResponseType("Hello " + requestType);
r.set(resp);
asyncHandler.handleResponse(r);
}
} .start();
return r;
}
The use of the org.apache.cxf.jaxws.ServerAsyncResponse class for the response
as shown above can simplify things and is recommended.| Modifier and Type | Optional Element and Description |
|---|---|
boolean |
always
By default, if continuations are not available,
it will use the non-async method.
|
Apache CXF