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