You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
644 B
33 lines
644 B
package core.thrift;
|
|
|
|
import org.apache.thrift.async.AsyncMethodCallback;
|
|
|
|
public class MyAsyncMethodCallback<E> implements AsyncMethodCallback<E> {
|
|
|
|
private boolean onComplete=true;
|
|
|
|
private E result;
|
|
|
|
public E getResult() throws InterruptedException {
|
|
while (result==null&&onComplete){
|
|
Thread.sleep(100);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
|
|
@Override
|
|
public void onComplete(E o) {
|
|
onComplete=false;
|
|
result=o;
|
|
}
|
|
|
|
@Override
|
|
public void onError(Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
|
|
public void setResult(E result) {
|
|
this.result = result;
|
|
}
|
|
}
|
|
|