1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.rice.kew.routemanager;
18
19 import org.kuali.rice.kew.messaging.exceptionhandling.ExceptionRoutingServiceImpl;
20 import org.kuali.rice.kew.test.TestUtilities;
21 import org.kuali.rice.ksb.messaging.PersistedMessage;
22 import org.kuali.rice.test.ThreadMonitor;
23
24
25
26 public class TestExceptionRoutingServiceImpl extends ExceptionRoutingServiceImpl {
27
28 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
29 .getLogger(TestExceptionRoutingServiceImpl.class);
30
31 @Override
32 public void placeInExceptionRouting(Throwable throwable, PersistedMessage persistedMessage, Long routeHeaderId) {
33 ExceptionThreader exceptionThreader = new ExceptionThreader(throwable, persistedMessage, routeHeaderId, this);
34 ThreadMonitor.addThread(exceptionThreader);
35 exceptionThreader.start();
36 }
37
38 private static class ExceptionThreader extends Thread {
39
40 private Throwable throwable;
41 private PersistedMessage message;
42 Long routeHeaderId;
43 private TestExceptionRoutingServiceImpl testExceptionService;
44
45 public ExceptionThreader(Throwable throwable, PersistedMessage message, Long routeHeaderId, TestExceptionRoutingServiceImpl testExceptionService) {
46 this.throwable = throwable;
47 this.message = message;
48 this.routeHeaderId = routeHeaderId;
49 this.testExceptionService = testExceptionService;
50 TestUtilities.setExceptionThreader(this);
51 }
52
53 public void run() {
54 try {
55 testExceptionService.callRealPlaceInExceptionRouting(throwable, message, routeHeaderId);
56 } catch (Exception e) {
57 LOG.error(e, e);
58 }
59 }
60 }
61
62 public void callRealPlaceInExceptionRouting(Throwable throwable, PersistedMessage message, Long routeHeaderId) throws Exception {
63 super.placeInExceptionRouting(throwable, message, routeHeaderId);
64 }
65 }