|
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;
|
@@ -303,23 +304,29 @@ public void run() {
|
303 | 304 |
|
304 | 305 | interceptorChain.applyBeforeConcurrentHandling(this.asyncWebRequest, callable);
|
305 | 306 | startAsyncProcessing(processingContext);
|
306 |
| - |
307 |
| - this.taskExecutor.submit(new Runnable() { |
308 |
| - public void run() { |
309 |
| - Object result = null; |
310 |
| - try { |
311 |
| - interceptorChain.applyPreProcess(asyncWebRequest, callable); |
312 |
| - result = callable.call(); |
313 |
| - } |
314 |
| - catch (Throwable ex) { |
315 |
| - result = ex; |
316 |
| - } |
317 |
| - finally { |
318 |
| - result = interceptorChain.applyPostProcess(asyncWebRequest, callable, result); |
| 307 | + try { |
| 308 | + this.taskExecutor.submit(new Runnable() { |
| 309 | + public void run() { |
| 310 | + Object result = null; |
| 311 | + try { |
| 312 | + interceptorChain.applyPreProcess(asyncWebRequest, callable); |
| 313 | + result = callable.call(); |
| 314 | + } |
| 315 | + catch (Throwable ex) { |
| 316 | + result = ex; |
| 317 | + } |
| 318 | + finally { |
| 319 | + result = interceptorChain.applyPostProcess(asyncWebRequest, callable, result); |
| 320 | + } |
| 321 | + setConcurrentResultAndDispatch(result); |
319 | 322 | }
|
320 |
| - setConcurrentResultAndDispatch(result); |
321 |
| - } |
322 |
| - }); |
| 323 | + }); |
| 324 | + } |
| 325 | + catch (RejectedExecutionException ex) { |
| 326 | + Object result = interceptorChain.applyPostProcess(this.asyncWebRequest, callable, ex); |
| 327 | + setConcurrentResultAndDispatch(result); |
| 328 | + throw ex; |
| 329 | + } |
323 | 330 | }
|
324 | 331 |
|
325 | 332 | private void setConcurrentResultAndDispatch(Object result) {
|
|
0 commit comments