Skip to content

Commit

Permalink
Allow specifying upn and spn
Browse files Browse the repository at this point in the history
  • Loading branch information
jianghaolu committed Sep 13, 2016
1 parent 89fc914 commit ac061a5
Showing 1 changed file with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.microsoft.azure;

import com.microsoft.rest.ServiceCall;

import java.util.concurrent.ConcurrentLinkedQueue;

/**
* Type represents a set of REST calls running possibly in parallel.
*/
public class ParallelServiceCall<T> extends ServiceCall<T> {
private ConcurrentLinkedQueue<ServiceCall<?>> serviceCalls;

/**
* Creates a ParallelServiceCall.
*/
public ParallelServiceCall() {
super(null);
this.serviceCalls = new ConcurrentLinkedQueue<>();
}

/**
* Cancels all the service calls currently executing.
*/
public void cancel() {
for (ServiceCall<?> call : this.serviceCalls) {
call.cancel();
}
}

/**
* @return true if the call has been canceled; false otherwise.
*/
public boolean isCancelled() {
for (ServiceCall<?> call : this.serviceCalls) {
if (!call.isCanceled()) {
return false;
}
}
return true;
}

/**
* Add a call to the list of parallel calls.
*
* @param call the call
*/
public void addCall(ServiceCall<?> call) {
this.serviceCalls.add(call);
}
}

0 comments on commit ac061a5

Please sign in to comment.