Package com.yahoo.jrt
Class TransportThread
java.lang.Object
com.yahoo.jrt.TransportThread
A single reactor/scheduler thread inside a potentially
multi-threaded
Transport
.-
Method Summary
Modifier and TypeMethodDescriptioncreateTask
(Runnable cmd) Creates aTask
that can be scheduled for execution in the transport thread.void
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.sync()
Synchronizes with the transport thread.void
wakeup()
Wakes up this transport thread explicitly.void
Wakes up this transport thread explicitly, but only if the calling thread is not the transport thread itself.
-
Method Details
-
transport
-
createTask
Creates aTask
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
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
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
-