Package com.yahoo.jrt

Class Transport

java.lang.Object
com.yahoo.jrt.Transport

public class Transport extends Object
The Transport class is the core needed to make your Supervisor tick. It implements the reactor pattern to perform multiplexed network IO, handles scheduled tasks and keeps track of some additional helper threads. A single Transport object can back multiple Supervisor objects.
  • Constructor Details

    • Transport

      public Transport(String name, FatalErrorHandler fatalHandler, CryptoEngine cryptoEngine, int numThreads, boolean tcpNoDelay, int eventsBeforeWakeup)
      Creates a new Transport object with the given fatal error handler and CryptoEngine. If a fatal error occurs when no fatal error handler is registered, the default action is to log the error and exit with exit code 1.
      Parameters:
      name - used for identifying threads
      fatalHandler - fatal error handler
      cryptoEngine - crypto engine to use
      numThreads - number of TransportThreads.
      eventsBeforeWakeup - number write events in Q before waking thread up
    • Transport

      public Transport(String name, CryptoEngine cryptoEngine, int numThreads, int eventsBeforeWakeup)
    • Transport

      public Transport(String name, CryptoEngine cryptoEngine, int numThreads)
    • Transport

      public Transport(String name, int numThreads, int eventsBeforeWakeup)
    • Transport

      public Transport(String name, int numThreads, boolean tcpNoDelay, int eventsBeforeWakeup)
    • Transport

      public Transport(String name, int numThreads)
    • Transport

      public Transport(String name)
    • Transport

      public Transport()
  • Method Details

    • selectThread

      public TransportThread selectThread()
      Selects and returns a random transport thread.
    • getName

      public String getName()
    • sync

      public Transport sync()
      Synchronizes with all transport threads. This method will block until all commands issued before this method was invoked has completed. If a transport thread has been shut down (or is in the progress of being shut down) this method will instead wait for the transport thread to complete, since no more commands will be performed, and waiting would be forever. Invoking this method from a transport thread is not a good idea.
      Returns:
      this object, to enable chaining
    • shutdown

      public Transport shutdown()
      Initiates controlled shutdown of all transport threads.
      Returns:
      this object, to enable chaining with join
    • join

      public void join()
      Waits for all transport threads to finish.
    • metrics

      public TransportMetrics metrics()