Class DelayedClientTransport

    • Field Detail

      • lock

        private final java.lang.Object lock
      • defaultAppExecutor

        private final java.util.concurrent.Executor defaultAppExecutor
      • reportTransportInUse

        private java.lang.Runnable reportTransportInUse
      • reportTransportNotInUse

        private java.lang.Runnable reportTransportNotInUse
      • reportTransportTerminated

        private java.lang.Runnable reportTransportTerminated
    • Constructor Detail

      • DelayedClientTransport

        DelayedClientTransport​(java.util.concurrent.Executor defaultAppExecutor,
                               SynchronizationContext syncContext)
        Creates a new delayed transport.
        Parameters:
        defaultAppExecutor - pending streams will create real streams and run buffered operations in an application executor, which will be this executor, unless there is on provided in CallOptions.
        syncContext - all listener callbacks of the delayed transport will be run from this SynchronizationContext.
    • Method Detail

      • start

        public final java.lang.Runnable start​(ManagedClientTransport.Listener listener)
        Description copied from interface: ManagedClientTransport
        Starts transport. This method may only be called once.

        This method and the returned Runnable should not throw any exceptions.

        Specified by:
        start in interface ManagedClientTransport
        Parameters:
        listener - non-null listener of transport events
        Returns:
        a Runnable that is executed after-the-fact by the original caller, typically after locks are released
      • ping

        public final void ping​(ClientTransport.PingCallback callback,
                               java.util.concurrent.Executor executor)
        Description copied from interface: ClientTransport
        Pings a remote endpoint. When an acknowledgement is received, the given callback will be invoked using the given executor.

        Pings are not necessarily sent to the same endpoint, thus a successful ping only means at least one endpoint responded, but doesn't imply the availability of other endpoints (if there is any).

        This is an optional method. Transports that do not have any mechanism by which to ping the remote endpoint may throw UnsupportedOperationException.

        Specified by:
        ping in interface ClientTransport
      • shutdownNow

        public final void shutdownNow​(Status status)
        Shuts down this transport and cancels all streams that it owns, hence immediately terminates this transport.
        Specified by:
        shutdownNow in interface ManagedClientTransport
      • hasPendingStreams

        public final boolean hasPendingStreams()
      • getPendingStreamsCount

        final int getPendingStreamsCount()
      • reprocess

        final void reprocess​(@Nullable
                             LoadBalancer.SubchannelPicker picker)
        Use the picker to try picking a transport for every pending stream, proceed the stream if the pick is successful, otherwise keep it pending.

        This method may be called concurrently with newStream(), and it's safe. All pending streams will be served by the latest picker (if a same picker is given more than once, they are considered different pickers) as soon as possible.

        This method must not be called concurrently with itself.

      • getLogId

        public InternalLogId getLogId()
        Description copied from interface: InternalWithLogId
        Returns an ID that is primarily used in debug logs. It usually contains the class name and a numeric ID that is unique among the instances.

        The subclasses of this interface usually want to include the log ID in their Object.toString() results.

        Specified by:
        getLogId in interface InternalWithLogId