Package com.yahoo.jrt

Class TransportThread

java.lang.Object
com.yahoo.jrt.TransportThread

public class TransportThread extends Object
A single reactor/scheduler thread inside a potentially multi-threaded Transport.
  • Method Details

    • transport

      public Transport transport()
    • createTask

      public Task createTask(Runnable cmd)
      Creates a Task that can be scheduled for execution in the transport thread.
      Parameters:
      cmd - what to run when the task is executed
      Returns:
      the newly created Task
    • perform

      public void perform(Runnable cmd)
      Performs the given command in such a way that it does not run concurrently with the transport thread or other commands performed by invoking this method. This method will continue to work even after the transport thread has been shut down.
      Parameters:
      cmd - the command to perform
    • wakeup

      public void wakeup()
      Wakes up this transport thread explicitly.
    • wakeup_if_not_self

      public void wakeup_if_not_self()
      Wakes up this transport thread explicitly, but only if the calling thread is not the transport thread itself.
    • sync

      public TransportThread sync()
      Synchronizes with the transport thread. This method will block until all commands issued before this method was invoked has completed. If the 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 the transport thread is not a good idea.
      Returns:
      this object, to enable chaining