Package com.yahoo.jrt

Class TransportThread


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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Task createTask​(java.lang.Runnable cmd)
      Create a Task that can be scheduled for execution in the transport thread.
      void perform​(java.lang.Runnable cmd)
      Perform 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.
      TransportThread sync()
      Synchronize with the transport thread.
      Transport transport()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • createTask

        public Task createTask​(java.lang.Runnable cmd)
        Create 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​(java.lang.Runnable cmd)
        Perform 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
      • sync

        public TransportThread sync()
        Synchronize 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