1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.ksb.messaging.remotedservices;
17
18 import org.kuali.rice.core.api.config.CoreConfigHelper;
19 import org.kuali.rice.ksb.messaging.service.KSBJavaService;
20
21 import java.io.Serializable;
22
23
24 public class TestHarnessSharedTopic implements KSBJavaService {
25
26 public static int CALL_COUNT = 0;
27 public static int CALL_COUNT_NOTIFICATION_THRESHOLD = 0;
28 public static Object LOCK = new Object();
29
30 public synchronized void invoke(Serializable payLoad) {
31 CALL_COUNT++;
32 System.out.println("!!!TestHarnessSharedTopic called with M.E " + CoreConfigHelper.getApplicationId() + " !!! ");
33 ServiceCallInformationHolder.flags.put("TestHarnessCalled", Boolean.TRUE);
34 if (CALL_COUNT_NOTIFICATION_THRESHOLD > 0) {
35 if (CALL_COUNT == CALL_COUNT_NOTIFICATION_THRESHOLD) {
36 notifyOnLock();
37 }
38 } else {
39 notifyOnLock();
40 }
41
42
43 }
44
45 public void notifyOnLock() {
46 synchronized (LOCK) {
47 LOCK.notifyAll();
48 }
49 }
50
51 }