The AsyncResponse.register() methods should have their signature changed to:
public AsyncResponse registerCallback(Class<?> callback, Class<?>
callbacks) throws NullPointerException, IllegalArgumentException;
public AsyncResponse registerCallback(Object callback, Object...
callbacks) throws NullPointerException, IllegalArgumentException;
Saves some typing when there is multiple callbacks. Also, IMO, renaming
the method to registerCallback makes the method self describing.
Otherwise you have to read the javadoc to know what it does.
Also, I do not think these methods belong on @Suspended
Class<? extends TimeoutHandler> timeoutHandler() default
DefaultTimeoutHandler.class;
Class<?>[] callbacks() default {};
DefaultTimeoutHandler should be removed as well. IMO, having this kind
of stuff in an annotation doesn't really provide any value or save any
typing or generally make things easier on the developer. I would even
make the case of removing timeout() or even the entire annotation. It's
just a matter of what looks nicer?
public void suspended(@Suspended(timeout=1, timeUnit=SECONDS,
callbacks=Foo.class, timeoutHandler=Timeout.class) AsyncResponse ) {...}
vs.
public void suspended(AsyncResponse response) {
response.timeout(1,
SECONDS).callbacks(Foo.class).timeoutHandler(Timeout.class);
}
I would say the second looks nicer. (if you add method chaining to
AsyncResponse).
On 8/8/2012 3:06 PM, Bill Burke wrote:
> I don't agree with @ManagedAsync. A method annotated with @ManagedAsync
> is executed in a separate thread? The servlet container is *already*
> doing this so I don't see the point of this annotation.
>
> Please make ConnectionCallback optional as I don't believe there is any
> capability within Servlet 3 of providing that functionality.
>
> Everything else looks good.
>
>
> On 8/8/2012 2:36 PM, Marek Potociar wrote:
>> Hello experts,
>>
>> Please review the latest async API changes:
>> http://java.net/projects/jax-rs-spec/sources/git/revision/c13c30bf78e7a5113e6dcd7384ef663bb3db51eb
>>
>> I tried to make sure the javadoc is self-explanatory. You may also want
>> to consult the async-related examples to see the API in action.
>>
>> Thanks,
>> Marek
>>
>
--
Bill Burke
JBoss, a division of Red Hat