public static FlowControlRuntimeException fromFlowControlException(FlowControlException e) { return new FlowControlRuntimeException(e); } }
@Override public ApiFuture<ResponseT> futureCall(RequestT request, ApiCallContext context) { if (batcherFactory.getBatchingSettings().getIsEnabled()) { BatchedFuture<ResponseT> result = BatchedFuture.<ResponseT>create(); UnaryCallable<RequestT, ResponseT> unaryCallable = callable.withDefaultCallContext(context); Batch<RequestT, ResponseT> batchableMessage = new Batch<RequestT, ResponseT>(batchingDescriptor, request, unaryCallable, result); PartitionKey partitionKey = batchingDescriptor.getBatchPartitionKey(request); ThresholdBatcher<Batch<RequestT, ResponseT>> batcher = batcherFactory.getPushingBatcher(partitionKey); try { batcher.add(batchableMessage); return result; } catch (FlowControlException e) { throw FlowControlRuntimeException.fromFlowControlException(e); } } else { return callable.futureCall(request, context); } } }
@Override public ApiFuture<ResponseT> futureCall(RequestT request, ApiCallContext context) { if (batcherFactory.getBatchingSettings().getIsEnabled()) { BatchedFuture<ResponseT> result = BatchedFuture.<ResponseT>create(); UnaryCallable<RequestT, ResponseT> unaryCallable = callable.withDefaultCallContext(context); Batch<RequestT, ResponseT> batchableMessage = new Batch<RequestT, ResponseT>(batchingDescriptor, request, unaryCallable, result); PartitionKey partitionKey = batchingDescriptor.getBatchPartitionKey(request); ThresholdBatcher<Batch<RequestT, ResponseT>> batcher = batcherFactory.getPushingBatcher(partitionKey); try { batcher.add(batchableMessage); return result; } catch (FlowControlException e) { throw FlowControlRuntimeException.fromFlowControlException(e); } } else { return callable.futureCall(request, context); } } }
public static FlowControlRuntimeException fromFlowControlException(FlowControlException e) { return new FlowControlRuntimeException(e); } }