@Nullable
  static ClientTransport getTransportFromPickResult(PickResult result, boolean isWaitForReady) {
    final ClientTransport transport;
    Subchannel subchannel = result.getSubchannel();
    if (subchannel != null) {
      transport = ((AbstractSubchannel) subchannel).obtainActiveTransport();
    } else {
      transport = null;
    }
    if (transport != null) {
      final ClientStreamTracer.Factory streamTracerFactory = result.getStreamTracerFactory();
      if (streamTracerFactory == null) {
        return transport;
      }
      return new ClientTransport() {
        @Override
        public ClientStream newStream(
            MethodDescriptor<?, ?> method, Metadata headers, CallOptions callOptions) {
          return transport.newStream(
              method, headers, callOptions.withStreamTracerFactory(streamTracerFactory));
        }

        @Override
        public void ping(PingCallback callback, Executor executor) {
          transport.ping(callback, executor);
        }

        @Override
        public InternalLogId getLogId() {
          return transport.getLogId();
        }

        @Override
        public ListenableFuture<SocketStats> getStats() {
          return transport.getStats();
        }
      };
    }
    if (!result.getStatus().isOk()) {
      if (result.isDrop()) {
        return new FailingClientTransport(result.getStatus(), RpcProgress.DROPPED);
      }
      if (!isWaitForReady) {
        return new FailingClientTransport(result.getStatus(), RpcProgress.PROCESSED);
      }
    }
    return null;
  }
@ Nullable static ClientTransport getTransportFromPickResult ( PickResult result , boolean isWaitForReady ) { final ClientTransport transport ; Subchannel subchannel = result . getSubchannel ( ) ; if ( subchannel != null ) { transport = ( ( AbstractSubchannel ) subchannel ) . obtainActiveTransport ( ) ; } else { transport = null ; } if ( transport != null ) { final ClientStreamTracer . Factory streamTracerFactory = result . getStreamTracerFactory ( ) ; if ( streamTracerFactory == null ) { return transport ; } return new ClientTransport ( ) { @ Override public ClientStream newStream ( MethodDescriptor < ? , ? > method , Metadata headers , CallOptions callOptions ) { return transport . newStream ( method , headers , callOptions . withStreamTracerFactory ( streamTracerFactory ) ) ; } @ Override public void ping ( PingCallback callback , Executor executor ) { transport . ping ( callback , executor ) ; } @ Override public InternalLogId getLogId ( ) { return transport . getLogId ( ) ; } @ Override public ListenableFuture < SocketStats > getStats ( ) { return transport . getStats ( ) ; } } ; } if ( ! result . getStatus ( ) . isOk ( ) ) { if ( result . isDrop ( ) ) { return new FailingClientTransport ( result . getStatus ( ) , RpcProgress . DROPPED ) ; } if ( ! isWaitForReady ) { return new FailingClientTransport ( result . getStatus ( ) , RpcProgress . PROCESSED ) ; } } return null ; }
Returns a transport out of a PickResult, or {@code null} if the result is "buffer".