From 323e5a16c84910035b3c18e1edd8a5c4d5c1562e Mon Sep 17 00:00:00 2001 From: Igor Berntein Date: Thu, 29 Aug 2024 14:47:52 -0400 Subject: [PATCH] format --- .../java/com/google/api/gax/batching/Batcher.java | 4 +--- .../com/google/api/gax/batching/BatcherImpl.java | 14 ++++++-------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/gax-java/gax/src/main/java/com/google/api/gax/batching/Batcher.java b/gax-java/gax/src/main/java/com/google/api/gax/batching/Batcher.java index 82d33867c3..3d8cad228b 100644 --- a/gax-java/gax/src/main/java/com/google/api/gax/batching/Batcher.java +++ b/gax-java/gax/src/main/java/com/google/api/gax/batching/Batcher.java @@ -79,9 +79,7 @@ public interface Batcher extends AutoCloseable { */ void sendOutstanding(); - /** - * Cancels all outstanding batch RPCs. - */ + /** Cancels all outstanding batch RPCs. */ void cancelOutstanding(); /** diff --git a/gax-java/gax/src/main/java/com/google/api/gax/batching/BatcherImpl.java b/gax-java/gax/src/main/java/com/google/api/gax/batching/BatcherImpl.java index 7763cafa23..e30460a910 100644 --- a/gax-java/gax/src/main/java/com/google/api/gax/batching/BatcherImpl.java +++ b/gax-java/gax/src/main/java/com/google/api/gax/batching/BatcherImpl.java @@ -91,7 +91,8 @@ public class BatcherImpl private final BatcherReference currentBatcherReference; private Batch currentOpenBatch; - private final ConcurrentMap, Boolean> outstandingBatches = new ConcurrentHashMap<>(); + private final ConcurrentMap, Boolean> + outstandingBatches = new ConcurrentHashMap<>(); private final Object flushLock = new Object(); private final Object elementLock = new Object(); private final Future scheduledFuture; @@ -370,7 +371,7 @@ private void awaitAllOutstandingBatches() throws InterruptedException { @Override public void cancelOutstanding() { - for (Batch batch : outstandingBatches.keySet()) { + for (Batch batch : outstandingBatches.keySet()) { batch.cancel(); } } @@ -399,7 +400,8 @@ public void close(@Nullable Duration timeout) throws InterruptedException { } } catch (TimeoutException e) { StringJoiner batchesStr = new StringJoiner(","); - for (Batch batch : outstandingBatches.keySet()) { + for (Batch batch : + outstandingBatches.keySet()) { batchesStr.add(batch.toString()); } String msg = "Timed out trying to close batcher after " + timeout + "."; @@ -503,7 +505,6 @@ void cancel() { } } - void onBatchSuccess(ResponseT response) { try { descriptor.splitResponse(response, entries); @@ -533,10 +534,7 @@ public String toString() { StringJoiner elementsStr = new StringJoiner(","); for (BatchEntry entry : entries) { elementsStr.add( - Optional.ofNullable(entry.getElement()) - .map(Object::toString) - .orElse("null") - ); + Optional.ofNullable(entry.getElement()).map(Object::toString).orElse("null")); } return MoreObjects.toStringHelper(this) .add("operation", operation)