Class ViewLocator

java.lang.Object
com.couchbase.client.core.node.RoundRobinLocator
com.couchbase.client.core.node.ViewLocator
All Implemented Interfaces:
Locator

public class ViewLocator extends RoundRobinLocator
The ViewLocator extends the round-robin locator with some custom checks.
  • Constructor Details

    • ViewLocator

      public ViewLocator()
  • Method Details

    • checkServiceNotAvailable

      protected boolean checkServiceNotAvailable(Request<? extends Response> request, ClusterConfig config)
      Description copied from class: RoundRobinLocator
      Can be overridden to check if a request should be cancelled immediately that the service is not supported.

      If this method returns false, something MUST be done with the request, or it will time out!

      Overrides:
      checkServiceNotAvailable in class RoundRobinLocator
    • nodeCanBeUsed

      protected boolean nodeCanBeUsed(Node node, Request<? extends Response> request, ClusterConfig config)
      In addition to checking that the view service is enabled, for view dispatching it is vital that a request is only ever sent to a node which has active primary KV partitions.
      Overrides:
      nodeCanBeUsed in class RoundRobinLocator
      Parameters:
      node - the node to check against.
      request - the request in scope.
      config - the cluster-level config.
      Returns:
      true if the node can be used to dispatch the request.