Class NetworkLatencyStrategy<T extends Endpoint>
java.lang.Object
services.moleculer.strategy.Strategy<T>
services.moleculer.strategy.ArrayBasedStrategy<T>
services.moleculer.strategy.XorShiftRandomStrategy<T>
services.moleculer.strategy.NetworkLatencyStrategy<T>
Lowest network latency strategy. This strategy comes from a random strategy,
but preferably communicates with the "closest" nodes (nodes with the lowest
response/ping time).
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final NetworkLatencyStrategyFactoryprotected final intThis strategy compares number of 'sampleCount' random node.Fields inherited from class XorShiftRandomStrategy
rndFields inherited from class ArrayBasedStrategy
endpointCache, endpoints, nodeID, preferLocal -
Constructor Summary
ConstructorsConstructorDescriptionNetworkLatencyStrategy(ServiceBroker broker, boolean preferLocal, int sampleCount, NetworkLatencyStrategyFactory factory) -
Method Summary
Methods inherited from class ArrayBasedStrategy
addEndpoint, getAllEndpoints, getEndpoint, getEndpointsByNodeID, isEmpty, remove
-
Field Details
-
sampleCount
protected final int sampleCountThis strategy compares number of 'sampleCount' random node. -
factory
-
-
Constructor Details
-
NetworkLatencyStrategy
public NetworkLatencyStrategy(ServiceBroker broker, boolean preferLocal, int sampleCount, NetworkLatencyStrategyFactory factory)
-
-
Method Details
-
next
-