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.exceptionhandling.DefaultExceptionServiceImpl;
19 import org.kuali.rice.test.TestUtilities;
20 import org.kuali.rice.test.ThreadMonitor;
21
22
23 public class TestExceptionRoutingServiceImpl extends DefaultExceptionServiceImpl {
24
25 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
26 .getLogger(TestExceptionRoutingServiceImpl.class);
27
28 public void placeInExceptionRouting(Throwable throwable, PersistedMessageBO message, Object service) {
29 ExceptionThreader exceptionThreader = new ExceptionThreader(throwable, message, service, this);
30 ThreadMonitor.addThread(exceptionThreader);
31 exceptionThreader.start();
32 }
33
34 private static class ExceptionThreader extends Thread {
35
36 private Throwable throwable;
37 private PersistedMessageBO message;
38 private Object service;
39 private TestExceptionRoutingServiceImpl testExceptionService;
40
41 public ExceptionThreader(Throwable throwable, PersistedMessageBO message, Object service, TestExceptionRoutingServiceImpl testExceptionService) {
42 this.throwable = throwable;
43 this.message = message;
44 this.service = service;
45 this.testExceptionService = testExceptionService;
46 TestUtilities.setExceptionThreader(this);
47 }
48
49 public void run() {
50 try {
51 this.testExceptionService.callRealPlaceInExceptionRouting(this.throwable, this.message, this.service);
52 } catch (Throwable t) {
53 LOG.fatal("Error executing callRealPlaceInExceptionRouting.", t);
54 }
55 }
56 }
57
58 public void callRealPlaceInExceptionRouting(Throwable throwable, PersistedMessageBO message, Object service) throws Exception {
59 super.placeInExceptionRouting(throwable, message, service);
60 }
61
62 }