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 TypeMethodDescriptionbooleanacquirePermit(String nsId) Request permission for a specific name service to continue the call and connect to downstream name node.booleanDetermine whether ns has registered handlers.Returns the JSON string of the available handler for each name service.intgetAvailablePermits(String nsId) Returns the available handler for each name service.voidreleasePermit(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.voidshutdown()Shutdown steps to stop accepting new permission requests and clean-up.
-
Method Details
-
acquirePermit
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
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
Returns the available handler for each name service.- Parameters:
nsId- name service id.- Returns:
- the available handler for each name service.
-
contains
Determine whether ns has registered handlers.- Parameters:
nsId- name service id.- Returns:
- true if the ns has registered handlers, false in other cases.
-