diff --git a/azure-client-runtime/src/main/java/com/microsoft/azure/TaskGroupBase.java b/azure-client-runtime/src/main/java/com/microsoft/azure/TaskGroupBase.java index 5078b8caa6..e53bfa0a01 100644 --- a/azure-client-runtime/src/main/java/com/microsoft/azure/TaskGroupBase.java +++ b/azure-client-runtime/src/main/java/com/microsoft/azure/TaskGroupBase.java @@ -21,7 +21,14 @@ */ public abstract class TaskGroupBase> implements TaskGroup { + /** + * Stores the tasks in this group and their dependency information. + */ private DAGraph> dag; + /** + * ServiceCall instance that aggregate a set of ServiceCalls each associated with + * the task in this group. + */ private ParallelServiceCall parallelServiceCall; /** @@ -87,7 +94,7 @@ public T taskResult(String taskId) { private void executeReadyTasksAsync(final ServiceCallback callback) { DAGNode nextNode = dag.getNext(); while (nextNode != null) { - ServiceCall serviceCall = nextNode.data().executeAsync(taskCallback(nextNode, callback)); + ServiceCall serviceCall = nextNode.data().executeAsync(taskCallback(nextNode, callback)); this.parallelServiceCall.addCall(serviceCall); nextNode = dag.getNext(); } @@ -165,8 +172,10 @@ public boolean isCancelled() { * * @param call the call */ - private void addCall(ServiceCall call) { - this.serviceCalls.add(call); + private void addCall(ServiceCall call) { + if (call != null) { + this.serviceCalls.add(call); + } } } } diff --git a/azure-client-runtime/src/main/java/com/microsoft/azure/TaskItem.java b/azure-client-runtime/src/main/java/com/microsoft/azure/TaskItem.java index 8f0a3459a2..1a4bd9a61b 100644 --- a/azure-client-runtime/src/main/java/com/microsoft/azure/TaskItem.java +++ b/azure-client-runtime/src/main/java/com/microsoft/azure/TaskItem.java @@ -38,5 +38,5 @@ public interface TaskItem { * @param callback callback to call on success or failure * @return the handle of the REST call */ - ServiceCall executeAsync(ServiceCallback callback); + ServiceCall executeAsync(ServiceCallback callback); }