Interface RouterRpcFairnessPolicyController

All Known Implementing Classes:
AbstractRouterRpcFairnessPolicyController, NoRouterRpcFairnessPolicyController, ProportionRouterRpcFairnessPolicyController, RouterAsyncRpcFairnessPolicyController, StaticRouterRpcFairnessPolicyController

@Private @Evolving public interface RouterRpcFairnessPolicyController
Interface to define handlers assignment for specific name services. This is needed to allow handlers provide a certain QoS for all name services configured. Implementations can choose to define any algorithm which would help maintain QoS. This is different when compared to FairCallQueue semantics as fairness has a separate context in router based federation. An implementation for example, could allocate a dedicated set of handlers per name service and allow handlers to continue making downstream name node calls if permissions are available, another implementation could use preemption semantics and dynamically increase or decrease handlers assigned per name service.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Request permission for a specific name service to continue the call and connect to downstream name node.
    boolean
    Determine whether ns has registered handlers.
    Returns the JSON string of the available handler for each name service.
    int
    Returns the available handler for each name service.
    void
    Handler threads are expected to invoke this method that signals controller to release the resources allocated to the thread for the particular name service.
    void
    Shutdown steps to stop accepting new permission requests and clean-up.
  • Method Details

    • acquirePermit

      boolean acquirePermit(String nsId)
      Request permission for a specific name service to continue the call and connect to downstream name node. Controllers based on policies defined and allocations done at start-up through assignHandlersToNameservices, may provide a permission or reject the request by throwing exception.
      Parameters:
      nsId - NS id for which a permission to continue is requested.
      Returns:
      true or false based on whether permit is given.
    • releasePermit

      void releasePermit(String nsId)
      Handler threads are expected to invoke this method that signals controller to release the resources allocated to the thread for the particular name service. This would mean permissions getting available for other handlers to request for this specific name service.
      Parameters:
      nsId - Name service id for which permission release request is made.
    • shutdown

      void shutdown()
      Shutdown steps to stop accepting new permission requests and clean-up.
    • getAvailableHandlerOnPerNs

      String getAvailableHandlerOnPerNs()
      Returns the JSON string of the available handler for each name service.
      Returns:
      the JSON string of the available handler for each name service.
    • getAvailablePermits

      int getAvailablePermits(String nsId)
      Returns the available handler for each name service.
      Parameters:
      nsId - name service id.
      Returns:
      the available handler for each name service.
    • contains

      boolean contains(String nsId)
      Determine whether ns has registered handlers.
      Parameters:
      nsId - name service id.
      Returns:
      true if the ns has registered handlers, false in other cases.