Updated Branches: refs/heads/javelin 107fccdf6 -> 3435ee060
Get rid of due-mode in AsyncCallFuture, it is too confusing and we don't have a use case of it Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/3435ee06 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/3435ee06 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/3435ee06 Branch: refs/heads/javelin Commit: 3435ee060488d2e9ce2261559648b384cb0363f1 Parents: 107fccd Author: Kelven Yang <[email protected]> Authored: Thu Jan 3 17:43:32 2013 -0800 Committer: Kelven Yang <[email protected]> Committed: Thu Jan 3 17:43:32 2013 -0800 ---------------------------------------------------------------------- .../framework/async/AsyncCallFuture.java | 18 +------------- .../framework/codestyle/AsyncSampleCallee.java | 7 ++--- 2 files changed, 5 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3435ee06/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallFuture.java ---------------------------------------------------------------------- diff --git a/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallFuture.java b/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallFuture.java index e9635de..67e8822 100644 --- a/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallFuture.java +++ b/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallFuture.java @@ -22,16 +22,13 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -public class AsyncCallFuture<T> implements Future<T>, AsyncCompletionCallback<T> { - - AsyncCompletionCallback <T> _callback; +public class AsyncCallFuture<T> implements Future<T> { Object _completed = new Object(); boolean _done = false; T _resultObject; // we will store a copy of the result object - public AsyncCallFuture(AsyncCompletionCallback <T> callback) { - _callback = callback; + public AsyncCallFuture() { } @Override @@ -75,23 +72,12 @@ public class AsyncCallFuture<T> implements Future<T>, AsyncCompletionCallback<T> return _done; } - @Override public void complete(T resultObject) { _resultObject = resultObject; synchronized(_completed) { _done = true; _completed.notifyAll(); } - - _callback.complete(resultObject); - } - - public void inplaceComplete(T resultObject) { - _resultObject = resultObject; - synchronized(_completed) { - _done = true; - _completed.notifyAll(); - } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3435ee06/framework/ipc/test/org/apache/cloudstack/framework/codestyle/AsyncSampleCallee.java ---------------------------------------------------------------------- diff --git a/framework/ipc/test/org/apache/cloudstack/framework/codestyle/AsyncSampleCallee.java b/framework/ipc/test/org/apache/cloudstack/framework/codestyle/AsyncSampleCallee.java index 59461a4..f1a4b10 100644 --- a/framework/ipc/test/org/apache/cloudstack/framework/codestyle/AsyncSampleCallee.java +++ b/framework/ipc/test/org/apache/cloudstack/framework/codestyle/AsyncSampleCallee.java @@ -19,17 +19,16 @@ package org.apache.cloudstack.framework.codestyle; import org.apache.cloudstack.framework.async.AsyncCallFuture; -import org.apache.cloudstack.framework.async.AsyncCompletionCallback; public class AsyncSampleCallee { AsyncSampleCallee _driver; - public AsyncCallFuture<String> createVolume(Object realParam, AsyncCompletionCallback<String> callback) { + public AsyncCallFuture<String> createVolume(Object realParam) { String result = "result object"; - AsyncCallFuture<String> call = new AsyncCallFuture<String>(callback); + AsyncCallFuture<String> call = new AsyncCallFuture<String>(); - call.inplaceComplete(result); + call.complete(result); return call; } }
