public synchronized void sendUnsent() { if (currentBatch != null) { try { currentBatch.run(); } finally { operationAccountant.registerOperation(currentBatch.completionFuture); } currentBatch = null; } }
private <RequestT extends MessageLite, ResponseT> ListenableFuture<ResponseT> call( AsyncCall<RequestT, ResponseT> rpc, RequestT request) { // Wait until both the memory and rpc count maximum requirements are achieved before getting a // unique id used to track this request. ListenableFuture<ResponseT> future; try { future = rpc.call(client, request); } catch (Throwable e) { future = Futures.immediateFailedFuture(e); } operationsAccountant.registerOperation(future); return future; }