cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kelv...@apache.org
Subject git commit: Enforce strong typing for getting result from AsyncMethod
Date Wed, 02 Jan 2013 23:49:11 GMT
Updated Branches:
  refs/heads/javelin e2078ec6e -> 6504fc6b0


Enforce strong typing for getting result from AsyncMethod


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/6504fc6b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/6504fc6b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/6504fc6b

Branch: refs/heads/javelin
Commit: 6504fc6b0947a3b721d515a5926cd542cdb4a37c
Parents: e2078ec
Author: Kelven Yang <kelveny@gmail.com>
Authored: Wed Jan 2 15:48:45 2013 -0800
Committer: Kelven Yang <kelveny@gmail.com>
Committed: Wed Jan 2 15:48:45 2013 -0800

----------------------------------------------------------------------
 .../storage/volume/VolumeServiceImpl.java          |    8 ++++----
 .../framework/async/AsyncCallbackDispatcher.java   |   14 +++++++-------
 2 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6504fc6b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
index df8d80a..b5687fd 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
@@ -175,7 +175,7 @@ public class VolumeServiceImpl implements VolumeService {
         templateOnPrimaryStoreObj.updateStatus(Status.DOWNLOAD_IN_PROGRESS);
 
         CreateBaseImageContext<VolumeInfo> context = new CreateBaseImageContext<VolumeInfo>(callback,
volume, dataStore, templateOnPrimaryStoreObj);
-        AsyncCallbackDispatcher<VolumeServiceImpl> caller = AsyncCallbackDispatcher.create(this);
+        AsyncCallbackDispatcher<VolumeServiceImpl, CommandResult> caller = AsyncCallbackDispatcher.create(this);
             caller.setCallback(caller.getTarget().createBaseImageCallback(null, null))
             .setContext(context);
 
@@ -183,7 +183,7 @@ public class VolumeServiceImpl implements VolumeService {
     }
 
     @DB
-    public Object createBaseImageCallback(AsyncCallbackDispatcher<VolumeServiceImpl>
callback, CreateBaseImageContext<VolumeInfo> context) {
+    public Object createBaseImageCallback(AsyncCallbackDispatcher<VolumeServiceImpl, CommandResult>
callback, CreateBaseImageContext<VolumeInfo> context) {
         CommandResult result = callback.getResult();
         TemplateOnPrimaryDataStoreObject templateOnPrimaryStoreObj = context.getTemplate();
         if (result.isSuccess()) {
@@ -222,7 +222,7 @@ public class VolumeServiceImpl implements VolumeService {
         }
 
         CreateVolumeFromBaseImageContext<VolumeInfo> context = new CreateVolumeFromBaseImageContext<VolumeInfo>(callback,
vo);
-        AsyncCallbackDispatcher<VolumeServiceImpl> caller =  AsyncCallbackDispatcher.create(this);
+        AsyncCallbackDispatcher<VolumeServiceImpl, CommandResult> caller =  AsyncCallbackDispatcher.create(this);
         caller.setCallback(caller.getTarget().createVolumeFromBaseImageCallback(null, null))
         .setContext(context);
 
@@ -230,7 +230,7 @@ public class VolumeServiceImpl implements VolumeService {
     }
     
     @DB
-    public Object createVolumeFromBaseImageCallback(AsyncCallbackDispatcher<VolumeServiceImpl>
callback, CreateVolumeFromBaseImageContext<VolumeInfo> context) {
+    public Object createVolumeFromBaseImageCallback(AsyncCallbackDispatcher<VolumeServiceImpl,
CommandResult> callback, CreateVolumeFromBaseImageContext<VolumeInfo> context) {
         VolumeObject vo = context.getVolumeObject();
         CommandResult result = callback.getResult();
         if (result.isSuccess()) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6504fc6b/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallbackDispatcher.java
----------------------------------------------------------------------
diff --git a/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallbackDispatcher.java
b/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallbackDispatcher.java
index 92a9d39..71fe6f0 100644
--- a/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallbackDispatcher.java
+++ b/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallbackDispatcher.java
@@ -29,7 +29,7 @@ import net.sf.cglib.proxy.MethodInterceptor;
 import net.sf.cglib.proxy.MethodProxy;
 
 @SuppressWarnings("rawtypes")
-public class AsyncCallbackDispatcher<T> implements AsyncCompletionCallback {
+public class AsyncCallbackDispatcher<T, R> implements AsyncCompletionCallback {
 	private Method _callbackMethod;
 	private T _targetObject;
 	private Object _contextObject;
@@ -41,7 +41,7 @@ public class AsyncCallbackDispatcher<T> implements AsyncCompletionCallback
{
 		_targetObject = target;
 	}
 	
-	public AsyncCallbackDispatcher<T> attachDriver(AsyncCallbackDriver driver) {
+	public AsyncCallbackDispatcher<T, R> attachDriver(AsyncCallbackDriver driver) {
 		assert(driver != null);
 		_driver = driver;
 		
@@ -83,11 +83,11 @@ public class AsyncCallbackDispatcher<T> implements AsyncCompletionCallback
{
 		return (T)en.create();
 	}
 
-	public AsyncCallbackDispatcher<T> setCallback(Object useless) {
+	public AsyncCallbackDispatcher<T, R> setCallback(Object useless) {
 		return this;
 	}
 	
-	public AsyncCallbackDispatcher<T> setContext(Object context) {
+	public AsyncCallbackDispatcher<T, R> setContext(Object context) {
 		_contextObject = context;
 		return this;
 	}
@@ -103,7 +103,7 @@ public class AsyncCallbackDispatcher<T> implements AsyncCompletionCallback
{
 	}
 
 	@SuppressWarnings("unchecked")
-	public <R> R getResult() {
+	public R getResult() {
 		return (R)_resultObject;
 	}
 
@@ -112,8 +112,8 @@ public class AsyncCallbackDispatcher<T> implements AsyncCompletionCallback
{
 		return _targetObject;
 	}
 	
-	public static <P> AsyncCallbackDispatcher<P> create(P target)  {
-		return new AsyncCallbackDispatcher<P>(target);
+	public static <P, R> AsyncCallbackDispatcher<P, R> create(P target)  {
+		return new AsyncCallbackDispatcher<P, R>(target);
 	}
 	
 	public static boolean dispatch(Object target, AsyncCallbackDispatcher callback) {


Mime
View raw message