mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-15 18:12:35 +01:00
remove parent concept from AsyncCallbackDispatcher, let user of AyncMethod handle high level concept of chaining
This commit is contained in:
parent
0581ea763a
commit
ea713c70a2
@ -28,8 +28,6 @@ import net.sf.cglib.proxy.MethodProxy;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class AsyncCallbackDispatcher<T> implements AsyncCompletionCallback {
|
||||
private AsyncCallbackDispatcher _parent;
|
||||
|
||||
private Method _callbackMethod;
|
||||
private T _targetObject;
|
||||
private Object _contextObject;
|
||||
@ -41,12 +39,6 @@ public class AsyncCallbackDispatcher<T> implements AsyncCompletionCallback {
|
||||
_targetObject = target;
|
||||
}
|
||||
|
||||
private AsyncCallbackDispatcher(T target, AsyncCallbackDispatcher parent) {
|
||||
assert(target != null);
|
||||
_targetObject = target;
|
||||
_parent = parent;
|
||||
}
|
||||
|
||||
public AsyncCallbackDispatcher<T> attachDriver(AsyncCallbackDriver driver) {
|
||||
assert(driver != null);
|
||||
_driver = driver;
|
||||
@ -89,12 +81,6 @@ public class AsyncCallbackDispatcher<T> implements AsyncCompletionCallback {
|
||||
_driver.performCompletionCallback(this);
|
||||
}
|
||||
|
||||
public void deepComplete(Object resultObject) {
|
||||
complete(resultObject);
|
||||
if(_parent != null)
|
||||
_parent.deepComplete(resultObject);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <R> R getResult() {
|
||||
return (R)_resultObject;
|
||||
@ -109,15 +95,6 @@ public class AsyncCallbackDispatcher<T> implements AsyncCompletionCallback {
|
||||
return new AsyncCallbackDispatcher<P>(target);
|
||||
}
|
||||
|
||||
public <P> AsyncCallbackDispatcher<P> chainToCreate(P target) {
|
||||
return new AsyncCallbackDispatcher<P>(target, this);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <P> AsyncCallbackDispatcher<P> getParent() {
|
||||
return (AsyncCallbackDispatcher<P>)_parent;
|
||||
}
|
||||
|
||||
public static boolean dispatch(Object target, AsyncCallbackDispatcher callback) {
|
||||
assert(callback != null);
|
||||
assert(target != null);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user