Class ConfigLocator
java.lang.Object
com.couchbase.client.core.node.locate.ConfigLocator
- All Implemented Interfaces:
Locator
public class ConfigLocator extends Object implements Locator
Locates the proper CONFIG node for a given config request.
Note that since the CONFIG service is not intended for high performance data ops, it does not implement the more
complex logic of MDS awareness that happens in other locators like for N1QL. The consequence of this is that in
MDS scenarios one config server might be hit more than once if the next one comes along, but that shouldn't
be a problem at all. If this needs to be fixed at some point, take a look at the
QueryLocator
which recently
got fixed to do all the right (but more complex) things.- Since:
- 1.0.0
- Author:
- Michael Nitschinger
-
Constructor Summary
Constructors Constructor Description ConfigLocator()
Generates the random initial value for the round robin counter used. -
Method Summary
Modifier and Type Method Description void
locateAndDispatch(CouchbaseRequest request, List<Node> nodes, ClusterConfig config, CoreEnvironment env, com.lmax.disruptor.RingBuffer<ResponseEvent> responseBuffer)
Given with the environment and node information, the implementation locates the right set of nodes and dispatches the request into them.
-
Constructor Details
-
ConfigLocator
public ConfigLocator()Generates the random initial value for the round robin counter used. This will generate a random number between 0 and 1023 which is probably enough distribution to not make all queries hit the same first server all the time.
-
-
Method Details
-
locateAndDispatch
public void locateAndDispatch(CouchbaseRequest request, List<Node> nodes, ClusterConfig config, CoreEnvironment env, com.lmax.disruptor.RingBuffer<ResponseEvent> responseBuffer)Description copied from interface:Locator
Given with the environment and node information, the implementation locates the right set of nodes and dispatches the request into them.- Specified by:
locateAndDispatch
in interfaceLocator
- Parameters:
request
- the request to dispatch.nodes
- the current list of active nodes.config
- the current cluster configuration.env
- the core environment.responseBuffer
- the response buffer for potential redistribution.
-