title: How to handle client cancel request in Spring 3?
body: <p>I have a Controller with a method mapped with @RequestMapping and it returns an object is JSON format so it also has @ResponseBody. Part of getting the object that it should return is a wait() on an object, in a producer/consumer type of situation. </p>
  
  <p>The client can of course cancel their request any time, but I want to be able to interrupt that wait() command the controller is doing when the client cancels. Currently the ajax request throws a client side error with statusType timeout and I can handle it on the client side. But it seems to still leave a thread waiting on the server side which I want to cleanup.</p>
  
  <p>But how?</p>
  
  <p>I seem to recall getting Socket Closed type of errors in older web apps, I dont see that happening with this Spring 3 app on WebLogic 10.3</p>
  
  <p>I see logging like this when the client request is cancelled while the controller is sitting on a wait():</p>
  
  <p>"  &lt;[STUCK] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)' has been busy for "623" seconds working on the request etc..."</p>