cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: How to interrupt Web Service?
Date Mon, 25 Jul 2011 20:54:56 GMT
On Friday, July 22, 2011 5:00:46 PM Tanveer ul Islam wrote:
> Greetings All,
> 
> In my web application when user clicks a button to load data, a call is
> given to remote web service. That web service takes very long as it has to
> do a heavy DB related task. In the mean time user can navigate away or
> cancel the request. If this happens, i also want the processing on the
> server to be interrupted. This means Web Service + Database queries +
> Executing Thread should be interrupted. My question is what is the right way
> to cancel/interrupt a web service invocation. How can i find out on the
> server side that the user has cancelled the request?

Honestly, there really isn't a way.    The client COULD invoke a separate 
cancel operation of some sort, but that doesn't really help in the cases where 
the user just goes away.   

On the server side, you could TRY (I have no idea if this works or not) to use 
the Continuation support in CXF using the timeouts.   Maybe every couple 
seconds, the continuation would "ping".  From there, I DON'T know if you can 
grab the HttpServletRequest or similar to see if you can somehow see if the 
client still has the socket open.  I don't really know.   

That said, with keep-alives and such, the browser/client may keep the socket 
open anyway.   

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com

Mime
View raw message