@@ -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