Skip to content

Commit d824fd4

Browse files
chore: apply fmt-maven-plugin
1 parent 5046f55 commit d824fd4

7 files changed

Lines changed: 46 additions & 42 deletions

File tree

java-bigtable/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/middleware/OpExecutor.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public void execute(Runnable r) {
7373
}
7474

7575
/**
76-
* Runs {@code r} synchronously on the caller thread if this executor is idle, otherwise queues
77-
* it for later drain on the backing executor. Either way, FIFO ordering with other tasks is
76+
* Runs {@code r} synchronously on the caller thread if this executor is idle, otherwise queues it
77+
* for later drain on the backing executor. Either way, FIFO ordering with other tasks is
7878
* preserved.
7979
*/
8080
public void runInline(Runnable r) {
@@ -104,7 +104,8 @@ public void runInline(Runnable r) {
104104
}
105105
}
106106

107-
// Schedule a drain on the backing executor. If the backing throws (e.g. RejectedExecutionException
107+
// Schedule a drain on the backing executor. If the backing throws (e.g.
108+
// RejectedExecutionException
108109
// during shutdown), reset drainScheduled before propagating so the next execute() can retry
109110
// instead of wedging the executor with no drainer.
110111
@GuardedBy("queue")

java-bigtable/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/middleware/RetryingVRpc.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ public void cancel(@Nullable String message, @Nullable Throwable cause) {
122122
public void requestNext() {
123123
// Assert the op-executor affinity even though the body is dead today — when streaming lands
124124
// and this becomes real, the missing assertion would silently allow off-thread access.
125-
// Guarded on context being set so a misuse before start() still throws UnsupportedOperationException
125+
// Guarded on context being set so a misuse before start() still throws
126+
// UnsupportedOperationException
126127
// rather than NPE on the assertion.
127128
if (context != null) {
128129
context.getExecutor().throwIfNotInThisExecutor();

java-bigtable/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/middleware/VOperationImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131

3232
/**
3333
* The single edge between the user and the VRpc middleware chain. Trampolines all inbound user
34-
* calls onto opExecutor and owns the gRPC {@link Context} cancellation listener so that every
35-
* layer below is single-threaded on opExecutor.
34+
* calls onto opExecutor and owns the gRPC {@link Context} cancellation listener so that every layer
35+
* below is single-threaded on opExecutor.
3636
*
3737
* <p>Precondition: {@link #cancel} must not be called before {@link #start}.
3838
*/

java-bigtable/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/SessionList.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ void onSessionStarted() {
170170
}
171171

172172
/**
173-
* The session is returned to the pool after a vRPC that reached the wire completes. Updates
174-
* the picker's per-AFE latency stats on success; non-OK results skip the latency update so a
173+
* The session is returned to the pool after a vRPC that reached the wire completes. Updates the
174+
* picker's per-AFE latency stats on success; non-OK results skip the latency update so a
175175
* fast-failing or cancelled-mid-flight AFE doesn't look the fastest.
176176
*/
177177
void onVRpcFinish(Duration elapsed, VRpcResult result) {
@@ -183,10 +183,9 @@ void onVRpcFinish(Duration elapsed, VRpcResult result) {
183183
}
184184

185185
/**
186-
* The session is returned to the pool after a pending vRPC was drained but cancelled before
187-
* it could be attached to a real call (e.g. user cancelled or deadline expired between
188-
* checkoutSession and drainTo). No latency is reported because the vRPC never reached the
189-
* wire.
186+
* The session is returned to the pool after a pending vRPC was drained but cancelled before it
187+
* could be attached to a real call (e.g. user cancelled or deadline expired between
188+
* checkoutSession and drainTo). No latency is reported because the vRPC never reached the wire.
190189
*/
191190
void onPendingVRpcCancelled() {
192191
releaseToPool();

java-bigtable/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/SessionPoolImpl.java

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -716,25 +716,29 @@ private void cancel(Status status, boolean onlyCancelPendingCall) {
716716
synchronized (SessionPoolImpl.this) {
717717
pendingRpcs.remove(this); // eager removal; no-op if already drained
718718
}
719-
ctx.getExecutor().execute(() -> {
720-
if (isCancelled) return;
721-
isCancelled = true;
722-
if (realCall != null) {
723-
if (!onlyCancelPendingCall) {
724-
realCall.cancel(status.getDescription(), status.getCause());
725-
}
726-
} else {
727-
listener.onClose(VRpcResult.createRejectedError(status));
728-
}
729-
});
719+
ctx.getExecutor()
720+
.execute(
721+
() -> {
722+
if (isCancelled) return;
723+
isCancelled = true;
724+
if (realCall != null) {
725+
if (!onlyCancelPendingCall) {
726+
realCall.cancel(status.getDescription(), status.getCause());
727+
}
728+
} else {
729+
listener.onClose(VRpcResult.createRejectedError(status));
730+
}
731+
});
730732
}
731733

732734
void cancelWithResult(VRpcResult result) {
733-
ctx.getExecutor().execute(() -> {
734-
if (isCancelled) return;
735-
isCancelled = true;
736-
listener.onClose(result);
737-
});
735+
ctx.getExecutor()
736+
.execute(
737+
() -> {
738+
if (isCancelled) return;
739+
isCancelled = true;
740+
listener.onClose(result);
741+
});
738742
}
739743

740744
@Override
@@ -750,14 +754,16 @@ private void drainTo(SessionHandle handle) {
750754
if (deadlineMonitor != null) {
751755
deadlineMonitor.cancel();
752756
}
753-
ctx.getExecutor().execute(() -> {
754-
if (isCancelled) {
755-
SessionPoolImpl.this.onPendingVRpcCancelled(handle);
756-
return;
757-
}
758-
realCall = newRealCall(desc, handle);
759-
realCall.start(req, ctx, listener);
760-
});
757+
ctx.getExecutor()
758+
.execute(
759+
() -> {
760+
if (isCancelled) {
761+
SessionPoolImpl.this.onPendingVRpcCancelled(handle);
762+
return;
763+
}
764+
realCall = newRealCall(desc, handle);
765+
realCall.start(req, ctx, listener);
766+
});
761767
}
762768

763769
private VRpcListener<RespT> getListener() {
@@ -908,5 +914,4 @@ public void close() {
908914
}
909915
}
910916
}
911-
912917
}

java-bigtable/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/session/SessionImplTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,7 @@ void abortFiresWhenListenerOnReadyThrows() throws Exception {
683683
SessionImpl session = new SessionImpl(metrics, poolInfo, 0, sessionFactory.createNew(), timer);
684684

685685
CountDownLatch onCloseLatch = new CountDownLatch(1);
686-
AtomicReference<Status> capturedStatus =
687-
new AtomicReference<>();
686+
AtomicReference<Status> capturedStatus = new AtomicReference<>();
688687

689688
Session.Listener throwingListener =
690689
new Session.Listener() {

java-bigtable/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/session/SessionPoolImplTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@
7878
import java.time.Instant;
7979
import java.util.List;
8080
import java.util.concurrent.CompletableFuture;
81-
import java.util.function.LongPredicate;
8281
import java.util.concurrent.CopyOnWriteArrayList;
8382
import java.util.concurrent.CountDownLatch;
8483
import java.util.concurrent.ExecutionException;
8584
import java.util.concurrent.Executors;
8685
import java.util.concurrent.ScheduledExecutorService;
8786
import java.util.concurrent.TimeUnit;
8887
import java.util.concurrent.TimeoutException;
88+
import java.util.function.LongPredicate;
8989
import org.junit.jupiter.api.AfterEach;
9090
import org.junit.jupiter.api.BeforeEach;
9191
import org.junit.jupiter.api.Nested;
@@ -429,8 +429,7 @@ public void test() throws Exception {
429429
// Match anything that isn't one of the two fixed cadences.
430430
long watchdogMs = Duration.ofMinutes(5).toMillis();
431431
long afePruneMs = SessionList.SESSION_LIST_PRUNE_INTERVAL.toMillis();
432-
LongPredicate isRetrySchedule =
433-
d -> d > 0 && d != watchdogMs && d != afePruneMs;
432+
LongPredicate isRetrySchedule = d -> d > 0 && d != watchdogMs && d != afePruneMs;
434433

435434
// start the pool
436435
sessionPool.start(

0 commit comments

Comments
 (0)