new ResultBoundedCompletionService<>( RpcRetryingCallerFactory.instantiate(ScannerCallableWithReplicas.this.conf), pool, regionReplication * 5); Future<Pair<Result[], ScannerCallable>> f = cs.poll(timeBeforeReplicas, Future<Pair<Result[], ScannerCallable>> f = cs.pollForFirstSuccessfullyCompletedTask(timeout, TimeUnit.MILLISECONDS, startIndex, endIndex); cs.cancelAll();
private void addCallsForCurrentReplica( ResultBoundedCompletionService<Pair<Result[], ScannerCallable>> cs) { RetryingRPC retryingOnReplica = new RetryingRPC(currentScannerCallable); outstandingCallables.add(currentScannerCallable); cs.submit(retryingOnReplica, scannerTimeout, currentScannerCallable.id); }
/** * Poll for the first completed task whether it is a success or execution exception. * * @param timeout - time to wait before it times out * @param unit - time unit for timeout */ public QueueingFuture<V> poll(long timeout, TimeUnit unit) throws InterruptedException { return pollForSpecificCompletedTask(timeout, unit, 0); }
: RegionReplicaUtil.DEFAULT_REPLICA_ID), cConnection, tableName, get.getRow()); ResultBoundedCompletionService<Result> cs = new ResultBoundedCompletionService<Result>(this.rpcRetryingCallerFactory, pool, rl.size()); try { Future<Result> f = cs.poll(timeBeforeReplicas, TimeUnit.MICROSECONDS); // Yes, microseconds if (f != null) { return f.get(); //great we got a response Future<Result> f = cs.take(); return f.get(); } catch (ExecutionException e) { cs.cancelAll();
new ResultBoundedCompletionService<Pair<Result[], ScannerCallable>>( RpcRetryingCallerFactory.instantiate(ScannerCallableWithReplicas.this.conf), pool, rl.size() * 5); Future<Pair<Result[], ScannerCallable>> f = cs.poll(timeBeforeReplicas, Future<Pair<Result[], ScannerCallable>> f = cs.poll(timeout, TimeUnit.MILLISECONDS); if (f != null) { Pair<Result[], ScannerCallable> r = f.get(timeout, TimeUnit.MILLISECONDS); cs.cancelAll();
new ResultBoundedCompletionService<>(this.rpcRetryingCallerFactory, pool, rl.size()); int startIndex = 0; int endIndex = rl.size(); try { Future<Result> f = cs.poll(timeBeforeReplicas, TimeUnit.MICROSECONDS); // Yes, microseconds if (f != null) { return f.get(); //great we got a response cs.pollForFirstSuccessfullyCompletedTask(operationTimeout, TimeUnit.MILLISECONDS, startIndex, endIndex); if (f == null) { throw new RetriesExhaustedException("Timed out after " + operationTimeout + cs.cancelAll();
/** * Creates the calls and submit them * * @param cs - the completion service to use for submitting * @param rl - the region locations * @param min - the id of the first replica, inclusive * @param max - the id of the last replica, inclusive. */ private void addCallsForReplica(ResultBoundedCompletionService<Result> cs, RegionLocations rl, int min, int max) { for (int id = min; id <= max; id++) { HRegionLocation hrl = rl.getRegionLocation(id); ReplicaRegionServerCallable callOnReplica = new ReplicaRegionServerCallable(id, hrl); cs.submit(callOnReplica, operationTimeout, id); } }
f = pollForSpecificCompletedTask(timeout, unit, i); duration = EnvironmentEdgeManager.currentTime() - start;
new ResultBoundedCompletionService<>( RpcRetryingCallerFactory.instantiate(ScannerCallableWithReplicas.this.conf), pool, regionReplication * 5); Future<Pair<Result[], ScannerCallable>> f = cs.poll(timeBeforeReplicas, Future<Pair<Result[], ScannerCallable>> f = cs.pollForFirstSuccessfullyCompletedTask(timeout, TimeUnit.MILLISECONDS, startIndex, endIndex); cs.cancelAll();
private void addCallsForOtherReplicas( ResultBoundedCompletionService<Pair<Result[], ScannerCallable>> cs, int min, int max) { for (int id = min; id <= max; id++) { if (currentScannerCallable.id == id) { continue; //this was already scheduled earlier } ScannerCallable s = currentScannerCallable.getScannerCallableForReplica(id); setStartRowForReplicaCallable(s); outstandingCallables.add(s); RetryingRPC retryingOnReplica = new RetryingRPC(s); cs.submit(retryingOnReplica, scannerTimeout, id); } }
/** * Poll for the first completed task whether it is a success or execution exception. * * @param timeout - time to wait before it times out * @param unit - time unit for timeout */ public QueueingFuture<V> poll(long timeout, TimeUnit unit) throws InterruptedException { return pollForSpecificCompletedTask(timeout, unit, 0); }
new ResultBoundedCompletionService<>(this.rpcRetryingCallerFactory, pool, rl.size()); int startIndex = 0; int endIndex = rl.size(); try { Future<Result> f = cs.poll(timeBeforeReplicas, TimeUnit.MICROSECONDS); // Yes, microseconds if (f != null) { return f.get(); //great we got a response cs.pollForFirstSuccessfullyCompletedTask(operationTimeout, TimeUnit.MILLISECONDS, startIndex, endIndex); if (f == null) { throw new RetriesExhaustedException("Timed out after " + operationTimeout + cs.cancelAll();
private void addCallsForCurrentReplica( ResultBoundedCompletionService<Pair<Result[], ScannerCallable>> cs) { RetryingRPC retryingOnReplica = new RetryingRPC(currentScannerCallable); outstandingCallables.add(currentScannerCallable); cs.submit(retryingOnReplica, scannerTimeout, currentScannerCallable.id); }
f = pollForSpecificCompletedTask(timeout, unit, i); duration = EnvironmentEdgeManager.currentTime() - start;
new ResultBoundedCompletionService<>( RpcRetryingCallerFactory.instantiate(ScannerCallableWithReplicas.this.conf), pool, regionReplication * 5); Future<Pair<Result[], ScannerCallable>> f = cs.poll(timeBeforeReplicas, Future<Pair<Result[], ScannerCallable>> f = cs.pollForFirstSuccessfullyCompletedTask(timeout, TimeUnit.MILLISECONDS, startIndex, endIndex); cs.cancelAll();
/** * Creates the calls and submit them * * @param cs - the completion service to use for submitting * @param rl - the region locations * @param min - the id of the first replica, inclusive * @param max - the id of the last replica, inclusive. */ private void addCallsForReplica(ResultBoundedCompletionService<Result> cs, RegionLocations rl, int min, int max) { for (int id = min; id <= max; id++) { HRegionLocation hrl = rl.getRegionLocation(id); ReplicaRegionServerCallable callOnReplica = new ReplicaRegionServerCallable(id, hrl); cs.submit(callOnReplica, operationTimeout, id); } }
/** * Poll for the first completed task whether it is a success or execution exception. * * @param timeout - time to wait before it times out * @param unit - time unit for timeout */ public QueueingFuture<V> poll(long timeout, TimeUnit unit) throws InterruptedException { return pollForSpecificCompletedTask(timeout, unit, 0); }
new ResultBoundedCompletionService<>(this.rpcRetryingCallerFactory, pool, rl.size()); int startIndex = 0; int endIndex = rl.size(); try { Future<Result> f = cs.poll(timeBeforeReplicas, TimeUnit.MICROSECONDS); // Yes, microseconds if (f != null) { return f.get(); //great we got a response cs.pollForFirstSuccessfullyCompletedTask(operationTimeout, TimeUnit.MILLISECONDS, startIndex, endIndex); if (f == null) { throw new RetriesExhaustedException("Timed out after " + operationTimeout + cs.cancelAll();
private void addCallsForOtherReplicas( ResultBoundedCompletionService<Pair<Result[], ScannerCallable>> cs, int min, int max) { for (int id = min; id <= max; id++) { if (currentScannerCallable.id == id) { continue; //this was already scheduled earlier } ScannerCallable s = currentScannerCallable.getScannerCallableForReplica(id); setStartRowForReplicaCallable(s); outstandingCallables.add(s); RetryingRPC retryingOnReplica = new RetryingRPC(s); cs.submit(retryingOnReplica, scannerTimeout, id); } }
f = pollForSpecificCompletedTask(timeout, unit, i); duration = EnvironmentEdgeManager.currentTime() - start;