Package com.yahoo.jrt

Class Supervisor

java.lang.Object
com.yahoo.jrt.Supervisor

public class Supervisor extends Object
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 Details

    • Supervisor

      public Supervisor(Transport transport)
      Creates a new Supervisor based on the given Transport
      Parameters:
      transport - object performing low-level operations for this Supervisor
  • Method Details

    • setDropEmptyBuffers

      public Supervisor setDropEmptyBuffers(boolean value)
      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

      public Transport transport()
      Obtains the underlying Transport object.
      Returns:
      underlying Transport object
    • addMethod

      public void addMethod(Method method)
      Adds a method to the set of methods held by this Supervisor
      Parameters:
      method - the method to add
    • removeMethod

      public void removeMethod(Method method)
      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

      public Target connect(Spec spec)
      Connects to the given address. The new Target will be associated with this Supervisor.
      Parameters:
      spec - where to connect
      Returns:
      Target representing our end of the connection
      See Also:
    • connect

      public Target connect(Spec spec, Object context)
      Connects to the given address. The new Target will be associated with this Supervisor and will have 'context' as application context.
      Parameters:
      spec - where to connect
      context - application context for the Target
      Returns:
      Target representing our end of the connection
      See Also:
    • listen

      public Acceptor listen(Spec spec) throws ListenFailedException
      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