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