Package com.yahoo.jrt
Class Transport
java.lang.Object
com.yahoo.jrt.Transport
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 Summary
ConstructorDescriptionTransport
(String name, CryptoEngine cryptoEngine, int numThreads) Transport
(String name, CryptoEngine cryptoEngine, int numThreads, int eventsBeforeWakeup) 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. -
Method Summary
-
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 threadsfatalHandler
- fatal error handlercryptoEngine
- crypto engine to usenumThreads
- number ofTransportThread
s.eventsBeforeWakeup
- number write events in Q before waking thread up
-
Transport
-
Transport
-
Transport
-
Transport
-
Transport
-
Transport
-
Transport
public Transport()
-
-
Method Details
-
selectThread
Selects and returns a random transport thread. -
getName
-
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
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
-