1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.ksb.messaging.callbacks;
17
18 import java.io.Serializable;
19
20 import org.kuali.rice.ksb.messaging.AsynchronousCall;
21 import org.kuali.rice.ksb.messaging.AsynchronousCallback;
22
23
24
25
26
27
28
29
30
31 public class SimpleCallback implements AsynchronousCallback {
32
33 private static final long serialVersionUID = -1097606463996858063L;
34
35 private Serializable returnObject;
36 private AsynchronousCall methodCall;
37
38 public void callback(Serializable returnObject, AsynchronousCall methodCall) {
39 this.returnObject = returnObject;
40 this.methodCall = methodCall;
41 }
42
43 public AsynchronousCall getMethodCall() {
44 return this.methodCall;
45 }
46
47 public void setMethodCall(AsynchronousCall methodCall) {
48 this.methodCall = methodCall;
49 }
50
51 public Serializable getReturnObject() {
52 return this.returnObject;
53 }
54
55 public void setReturnObject(Serializable returnObject) {
56 this.returnObject = returnObject;
57 }
58
59 public synchronized void waitForAsyncCall() throws InterruptedException {
60 waitForAsyncCall(-1);
61 }
62
63 public synchronized void waitForAsyncCall(long millis) throws InterruptedException {
64 if (millis < 0) {
65 this.wait(60000);
66 } else {
67 this.wait(millis);
68 }
69 }
70
71 }