Package com.yahoo.jrt
Class Supervisor
java.lang.Object
com.yahoo.jrt.Supervisor
A Supervisor keeps a method repository and handles dispatching of
incoming invocation requests. Each end-point of a connection is
represented by a
Target
object and each Target
is
associated with a single Supervisor that handles the invocation
requests obtained from that Target
. Note that RPC
invocations can be performed both ways across a connection, so even
the client side of a connection has RPC server capabilities.-
Constructor Summary
ConstructorDescriptionSupervisor
(Transport transport) Creates a new Supervisor based on the givenTransport
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a method to the set of methods held by this SupervisorConnects to the given address.Connects to the given address.Listens to the given address.void
removeMethod
(Method method) Removes a method from the set of methods held by this Supervisor.setDropEmptyBuffers
(boolean value) Drops empty buffers.void
setMaxInputBufferSize
(int bytes) Sets maximum input buffer size.void
setMaxOutputBufferSize
(int bytes) Sets maximum output buffer size.Obtains the underlying Transport object.
-
Constructor Details
-
Supervisor
Creates a new Supervisor based on the givenTransport
- Parameters:
transport
- object performing low-level operations for this Supervisor
-
-
Method Details
-
setDropEmptyBuffers
Drops empty buffers. This will reduce memory footprint for idle connections at the cost of extra allocations when buffer space is needed again.- Parameters:
value
- true means drop empty buffers
-
setMaxInputBufferSize
public void setMaxInputBufferSize(int bytes) Sets maximum input buffer size. This value will only affect connections that use a common input buffer when decoding incoming packets. Note that this value is not an absolute max. The buffer will still grow larger than this value if needed to decode big packets. However, when the buffer becomes larger than this value, it will be shrunk back when possible.- Parameters:
bytes
- buffer size in bytes. 0 means unlimited.
-
setMaxOutputBufferSize
public void setMaxOutputBufferSize(int bytes) Sets maximum output buffer size. This value will only affect connections that use a common output buffer when encoding outgoing packets. Note that this value is not an absolute max. The buffer will still grow larger than this value if needed to encode big packets. However, when the buffer becomes larger than this value, it will be shrunk back when possible.- Parameters:
bytes
- buffer size in bytes. 0 means unlimited.
-
transport
Obtains the underlying Transport object.- Returns:
- underlying Transport object
-
addMethod
Adds a method to the set of methods held by this Supervisor- Parameters:
method
- the method to add
-
removeMethod
Removes a method from the set of methods held by this Supervisor. Use this if you know exactly which method to remove and not only the name.- Parameters:
method
- the method to remove
-
connect
Connects to the given address. The newTarget
will be associated with this Supervisor.- Parameters:
spec
- where to connect- Returns:
- Target representing our end of the connection
- See Also:
-
connect
Connects to the given address. The newTarget
will be associated with this Supervisor and will have 'context' as application context.- Parameters:
spec
- where to connectcontext
- application context for the Target- Returns:
- Target representing our end of the connection
- See Also:
-
listen
Listens to the given address.- Parameters:
spec
- the address to listen to- Returns:
- active object accepting new connections that will be associated with this Supervisor
- Throws:
ListenFailedException
-