|
1 | 1 | /* |
2 | | - * Copyright 2002-2014 the original author or authors. |
| 2 | + * Copyright 2002-2015 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
|
21 | 21 | import java.util.List; |
22 | 22 | import java.util.Map; |
23 | 23 | import java.util.concurrent.Callable; |
| 24 | +import java.util.concurrent.RejectedExecutionException; |
24 | 25 | import javax.servlet.http.HttpServletRequest; |
25 | 26 |
|
26 | 27 | import org.apache.commons.logging.Log; |
@@ -306,24 +307,30 @@ public void run() { |
306 | 307 |
|
307 | 308 | interceptorChain.applyBeforeConcurrentHandling(this.asyncWebRequest, callable); |
308 | 309 | startAsyncProcessing(processingContext); |
309 | | - |
310 | | - this.taskExecutor.submit(new Runnable() { |
311 | | - @Override |
312 | | - public void run() { |
313 | | - Object result = null; |
314 | | - try { |
315 | | - interceptorChain.applyPreProcess(asyncWebRequest, callable); |
316 | | - result = callable.call(); |
317 | | - } |
318 | | - catch (Throwable ex) { |
319 | | - result = ex; |
320 | | - } |
321 | | - finally { |
322 | | - result = interceptorChain.applyPostProcess(asyncWebRequest, callable, result); |
| 310 | + try { |
| 311 | + this.taskExecutor.submit(new Runnable() { |
| 312 | + @Override |
| 313 | + public void run() { |
| 314 | + Object result = null; |
| 315 | + try { |
| 316 | + interceptorChain.applyPreProcess(asyncWebRequest, callable); |
| 317 | + result = callable.call(); |
| 318 | + } |
| 319 | + catch (Throwable ex) { |
| 320 | + result = ex; |
| 321 | + } |
| 322 | + finally { |
| 323 | + result = interceptorChain.applyPostProcess(asyncWebRequest, callable, result); |
| 324 | + } |
| 325 | + setConcurrentResultAndDispatch(result); |
323 | 326 | } |
324 | | - setConcurrentResultAndDispatch(result); |
325 | | - } |
326 | | - }); |
| 327 | + }); |
| 328 | + } |
| 329 | + catch (RejectedExecutionException ex) { |
| 330 | + Object result = interceptorChain.applyPostProcess(this.asyncWebRequest, callable, ex); |
| 331 | + setConcurrentResultAndDispatch(result); |
| 332 | + throw ex; |
| 333 | + } |
327 | 334 | } |
328 | 335 |
|
329 | 336 | private void setConcurrentResultAndDispatch(Object result) { |
|
0 commit comments