Skip to content

Commit 206570c

Browse files
committed
undo startInternal to minimize diff
1 parent 87f1c13 commit 206570c

1 file changed

Lines changed: 23 additions & 20 deletions

File tree

binder/src/main/java/io/grpc/binder/internal/BinderTransport.java

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -648,28 +648,31 @@ public synchronized void onUnbound(Status reason) {
648648
@Override
649649
public synchronized Runnable start(ManagedClientTransport.Listener clientTransportListener) {
650650
this.clientTransportListener = checkNotNull(clientTransportListener);
651-
return this::startInternal;
652-
}
653-
654-
private synchronized void startInternal() {
655-
if (inState(TransportState.NOT_STARTED)) {
656-
setState(TransportState.SETUP);
657-
try {
658-
if (preAuthorizeServer) {
659-
preAuthorize(serviceBinding.resolve());
660-
} else {
661-
serviceBinding.bind();
651+
return () -> {
652+
synchronized (BinderClientTransport.this) {
653+
if (inState(TransportState.NOT_STARTED)) {
654+
setState(TransportState.SETUP);
655+
try {
656+
if (preAuthorizeServer) {
657+
preAuthorize(serviceBinding.resolve());
658+
} else {
659+
serviceBinding.bind();
660+
}
661+
} catch (StatusException e) {
662+
shutdownInternal(e.getStatus(), true);
663+
return;
664+
}
665+
if (readyTimeoutMillis >= 0) {
666+
readyTimeoutFuture =
667+
getScheduledExecutorService()
668+
.schedule(
669+
BinderClientTransport.this::onReadyTimeout,
670+
readyTimeoutMillis,
671+
MILLISECONDS);
672+
}
662673
}
663-
} catch (StatusException e) {
664-
shutdownInternal(e.getStatus(), true);
665-
return;
666-
}
667-
if (readyTimeoutMillis >= 0) {
668-
readyTimeoutFuture =
669-
getScheduledExecutorService()
670-
.schedule(this::onReadyTimeout, readyTimeoutMillis, MILLISECONDS);
671674
}
672-
}
675+
};
673676
}
674677

675678
@GuardedBy("this")

0 commit comments

Comments
 (0)