View Javadoc

1   /**
2    * Copyright 2005-2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
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 org.kuali.rice.ksb.messaging.callbacks;
17  
18  import java.io.Serializable;
19  
20  import org.kuali.rice.ksb.api.messaging.AsynchronousCall;
21  import org.kuali.rice.ksb.api.messaging.AsynchronousCallback;
22  
23  
24  /**
25   * This is a description of what this class does - rkirkend don't forget to fill
26   * this in.
27   * 
28   * @author Kuali Rice Team (rice.collab@kuali.org)
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  }