Browse code

[core] BM-11630 Fix: cancel rejected tasks correctly to ensure the client gets an answer

Thomas Cataldo authored on 25/06/2017 14:29:05
Showing 1 changed files
... ...
@@ -53,7 +53,11 @@ public class BMExecutor {
53 53
 
54 54
 		@Override
55 55
 		public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
56
-			if (r instanceof FutureTask) {
56
+			if (r instanceof BMFutureTask) {
57
+				BMFutureTask task = (BMFutureTask) r;
58
+				task.cancel(false);
59
+				task.task.cancelled();
60
+			} else if (r instanceof FutureTask) {
57 61
 				FutureTask<?> task = (FutureTask<?>) r;
58 62
 				task.cancel(false);
59 63
 			} else {