Class InProcessTransport

    • Field Detail

      • log

        private static final java.util.logging.Logger log
      • isEnabledSupportTracingMessageSizes

        static boolean isEnabledSupportTracingMessageSizes
      • address

        private final java.net.SocketAddress address
      • clientMaxInboundMetadataSize

        private final int clientMaxInboundMetadataSize
      • authority

        private final java.lang.String authority
      • userAgent

        private final java.lang.String userAgent
      • serverMaxInboundMetadataSize

        private int serverMaxInboundMetadataSize
      • includeCauseWithStatus

        private final boolean includeCauseWithStatus
      • serverSchedulerPool

        private ObjectPool<java.util.concurrent.ScheduledExecutorService> serverSchedulerPool
      • serverScheduler

        private java.util.concurrent.ScheduledExecutorService serverScheduler
      • serverStreamAttributes

        private Attributes serverStreamAttributes
      • assumedMessageSize

        private final long assumedMessageSize
      • shutdown

        private boolean shutdown
      • terminated

        private boolean terminated
      • shutdownStatus

        private Status shutdownStatus
      • uncaughtExceptionHandler

        private java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler
    • Constructor Detail

      • InProcessTransport

        public InProcessTransport​(java.net.SocketAddress address,
                                  int maxInboundMetadataSize,
                                  java.lang.String authority,
                                  java.lang.String userAgent,
                                  Attributes eagAttrs,
                                  boolean includeCauseWithStatus,
                                  long assumedMessageSize)
    • Method Detail

      • start

        @CheckReturnValue
        public 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 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
      • shutdown

        public void shutdown()
        Description copied from interface: ServerTransport
        Initiates an orderly shutdown of the transport. Existing streams continue, but new streams will eventually begin failing. New streams "eventually" begin failing because shutdown may need to be processed on a separate thread. May only be called once.
        Specified by:
        shutdown in interface ServerTransport
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • 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
      • getScheduledExecutorService

        public java.util.concurrent.ScheduledExecutorService getScheduledExecutorService()
        Description copied from interface: ServerTransport
        Returns an executor for scheduling provided by the transport. The service should be configured to allow cancelled scheduled runnables to be GCed.

        The executor may not be used after the transport terminates. The caller should ensure any outstanding tasks are cancelled when the transport terminates.

        Specified by:
        getScheduledExecutorService in interface ServerTransport
      • notifyShutdown

        private void notifyShutdown​(Status s)
      • notifyTerminated

        private void notifyTerminated()
      • metadataSize

        private static int metadataSize​(Metadata metadata)
      • cleanStatus

        private static Status cleanStatus​(Status status,
                                          boolean includeCauseWithStatus)
        Returns a new status with the same code and description. If includeCauseWithStatus is true, cause is also included.

        For InProcess transport to behave in the same way as the other transports, when exchanging statuses between client and server and vice versa, the cause should be excluded from the status. For easier debugging, the status may be optionally included.