001/**
002 * Copyright 2005-2014 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.ksb.messaging.callbacks;
017
018import java.io.Serializable;
019
020import org.kuali.rice.ksb.api.messaging.AsynchronousCall;
021import org.kuali.rice.ksb.api.messaging.AsynchronousCallback;
022
023
024/**
025 * This is a description of what this class does - rkirkend don't forget to fill
026 * this in.
027 * 
028 * @author Kuali Rice Team (rice.collab@kuali.org)
029 *
030 */
031public class SimpleCallback implements AsynchronousCallback {
032
033    private static final long serialVersionUID = -1097606463996858063L;
034    
035    private Serializable returnObject;
036    private AsynchronousCall methodCall;
037
038    public void callback(Serializable returnObject, AsynchronousCall methodCall) {
039        this.returnObject = returnObject;
040        this.methodCall = methodCall;
041    }
042
043    public AsynchronousCall getMethodCall() {
044        return this.methodCall;
045    }
046
047    public void setMethodCall(AsynchronousCall methodCall) {
048        this.methodCall = methodCall;
049    }
050
051    public Serializable getReturnObject() {
052        return this.returnObject;
053    }
054
055    public void setReturnObject(Serializable returnObject) {
056        this.returnObject = returnObject;
057    }
058    
059    public synchronized void waitForAsyncCall() throws InterruptedException {
060        waitForAsyncCall(-1);
061    }
062    
063    public synchronized void waitForAsyncCall(long millis) throws InterruptedException {
064        if (millis < 0) {
065            this.wait(60000);
066        } else {
067            this.wait(millis);    
068        }
069    }
070
071}