diff --git a/azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceCall.java b/azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceCall.java index 6fb08726d1cb3..e9c8728b67f97 100644 --- a/azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceCall.java +++ b/azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceCall.java @@ -10,12 +10,13 @@ import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseWithHeaders; + +import java.util.List; + import rx.Observable; import rx.Subscriber; import rx.functions.Func1; -import java.util.List; - /** * An instance of this class provides access to the underlying REST call invocation. * This class wraps around the Retrofit Call object and allows updates to it in the @@ -116,7 +117,7 @@ public void onNext(ServiceResponse> serviceResponse) { } } if (behavior == ListOperationCallback.PagingBehavior.STOP || serviceResponse.getBody().getNextPageLink() == null) { - serviceCall.set(new ServiceResponse<>(lastResponse.getBody().getItems(), lastResponse.getResponse())); + serviceCall.set(lastResponse.getBody().getItems()); } else { serviceCall.setSubscription(next.call(serviceResponse.getBody().getNextPageLink()).single().subscribe(this)); } diff --git a/azure-client-runtime/src/main/java/com/microsoft/azure/ListOperationCallback.java b/azure-client-runtime/src/main/java/com/microsoft/azure/ListOperationCallback.java index 63dc60f9f7c6b..3f841b6834588 100644 --- a/azure-client-runtime/src/main/java/com/microsoft/azure/ListOperationCallback.java +++ b/azure-client-runtime/src/main/java/com/microsoft/azure/ListOperationCallback.java @@ -8,7 +8,6 @@ package com.microsoft.azure; import com.microsoft.rest.ServiceCallback; -import com.microsoft.rest.ServiceResponse; import java.util.List; @@ -71,7 +70,7 @@ public void load(List result) { } @Override - public void success(ServiceResponse> result) { + public void success(List result) { success(); } diff --git a/client-runtime/src/main/java/com/microsoft/rest/ServiceCall.java b/client-runtime/src/main/java/com/microsoft/rest/ServiceCall.java index be18dd23a8064..949ef7b8879f2 100644 --- a/client-runtime/src/main/java/com/microsoft/rest/ServiceCall.java +++ b/client-runtime/src/main/java/com/microsoft/rest/ServiceCall.java @@ -8,6 +8,7 @@ package com.microsoft.rest; import com.google.common.util.concurrent.AbstractFuture; + import rx.Observable; import rx.Subscription; import rx.functions.Action1; @@ -19,7 +20,7 @@ * * @param the type of the returning object */ -public class ServiceCall extends AbstractFuture> { +public class ServiceCall extends AbstractFuture { /** * The Retrofit method invocation. */ @@ -42,7 +43,7 @@ public static ServiceCall create(final Observable> obs .subscribe(new Action1>() { @Override public void call(ServiceResponse t) { - serviceCall.set(t); + serviceCall.set(t.getBody()); } }, new Action1() { @Override @@ -69,9 +70,9 @@ public static ServiceCall create(final Observable> obs @Override public void call(ServiceResponse t) { if (callback != null) { - callback.success(t); + callback.success(t.getBody()); } - serviceCall.set(t); + serviceCall.set(t.getBody()); } }, new Action1() { @Override @@ -102,9 +103,9 @@ public static ServiceCall createWithHeaders(final Observable t) { if (callback != null) { - callback.success(t); + callback.success(t.getBody()); } - serviceCall.set(t); + serviceCall.set(t.getBody()); } }, new Action1() { @Override @@ -129,17 +130,6 @@ protected void setSubscription(Subscription subscription) { this.subscription = subscription; } - /** - * Invoke this method to report completed, allowing - * {@link AbstractFuture#get()} to be unblocked. - * - * @param result the service response returned. - * @return true if successfully reported; false otherwise. - */ - public boolean success(ServiceResponse result) { - return set(result); - } - @Override public boolean cancel(boolean mayInterruptIfRunning) { subscription.unsubscribe(); diff --git a/client-runtime/src/main/java/com/microsoft/rest/ServiceCallback.java b/client-runtime/src/main/java/com/microsoft/rest/ServiceCallback.java index dd3791bbb2d19..c3961b880a80f 100644 --- a/client-runtime/src/main/java/com/microsoft/rest/ServiceCallback.java +++ b/client-runtime/src/main/java/com/microsoft/rest/ServiceCallback.java @@ -23,7 +23,7 @@ public abstract class ServiceCallback { /** * Override this method to handle successful REST call results. * - * @param result the ServiceResponse holding the response. + * @param result the result object. */ - public abstract void success(ServiceResponse result); + public abstract void success(T result); }