[GLASSFISH-20629] Future.cancel() without effect Created: 12/Jun/13  Updated: 12/Jun/13  Resolved: 12/Jun/13

Status: Resolved
Project: glassfish
Component/s: None
Affects Version/s: 3.1.1_b12
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Thomas_Hamann Assignee: marina vatkina
Resolution: Works as designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

OS independent


I implemented a restful web service and a stateless session bean. The web service calls a method of the bean which is annotated with @Asynchronous and returns an instance of AsyncResult. After a while the web service calls the cancel() method of that result while the asynchronous method call is still computing. After that "cancellation" both the isCancelled() and the isDone() methods of the result/future return true. Thus the asynchronous bean call should be interrupted or cancelled. But it is still alive until it itself decides to finish gracefully or not.
With this erroneous implementation or handling the Future.cancel() method is of no use to an application developer. And asynchronous calls loose one of their major advantages.

Comment by marina vatkina [ 12/Jun/13 ]

This is per the EJB spec. See Future.cancel(boolean mayInterruptIfRunning) in the EJB 3.2

Generated at Tue Dec 01 06:01:50 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.