On 8/22/2012 4:32 PM, Marek Potociar wrote:
> FYI - the change is in:
> http://java.net/projects/jax-rs-spec/sources/git/revision/a31a86313a42ed5e72162676472839498096a3b6
> I have decided to leave out onError() from CompletionCallback in the end
> as it didn't make sense when I was trying to document the method.
> Perhaps if someone could explain me better when the method would be
> called and why we need it, I can add it.
>
Its a must, IMO. Basically it would get called when the server is
unable to stream the Response back to the client (socket closed or
something).
Use Case(for the 3rd time I'll repeat myself):
You ahve a transaction that if the response is *successfully* sent back
to the client (over the wire) commit the transaction. If the response
failed to be streamed back to the client (socket closed or some other
IOException), the rollback the transaction.
"transaction" doesn't necessarily have to be a JTA transaction, but
rather a service that needs to know whether or not the response was
streamed back to the client so that it can perform accordingly.
FYI, this callback exists in Servlet 3 async listener too.
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com