01: /*
02: * Copyright 2007 The Kuali Foundation
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package edu.iu.uis.eden.messaging.remotedservices;
17:
18: import java.io.Serializable;
19:
20: import org.kuali.rice.core.Core;
21:
22: import edu.iu.uis.eden.messaging.KEWJavaService;
23:
24: public class TestHarnessSharedTopic implements KEWJavaService {
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 void invoke(Serializable payLoad) {
31: CALL_COUNT++;
32: System.out.println("!!!TestHarnessSharedTopic called with M.E "
33: + Core.getCurrentContextConfig().getMessageEntity()
34: + " !!! ");
35: ServiceCallInformationHolder.stuff.put("TestHarnessCalled",
36: Boolean.TRUE);
37: if (CALL_COUNT_NOTIFICATION_THRESHOLD > 0) {
38: if (CALL_COUNT == CALL_COUNT_NOTIFICATION_THRESHOLD) {
39: notifyOnLock();
40: }
41: } else {
42: notifyOnLock();
43: }
44:
45: }
46:
47: public void notifyOnLock() {
48: synchronized (LOCK) {
49: LOCK.notifyAll();
50: }
51: }
52:
53: }
|