public class DynamicEndpointSnitch extends AbstractEndpointSnitch implements LatencySubscribers.Subscriber, DynamicEndpointSnitchMBean
Modifier and Type | Field and Description |
---|---|
IEndpointSnitch |
subsnitch |
Constructor and Description |
---|
DynamicEndpointSnitch(IEndpointSnitch snitch) |
DynamicEndpointSnitch(IEndpointSnitch snitch,
java.lang.String instance) |
Modifier and Type | Method and Description |
---|---|
void |
applyConfigChanges()
Update configuration from
DatabaseDescriptor and estart the update-scheduler and reset-scheduler tasks
if the configured rates for these tasks have changed. |
void |
close() |
int |
compareEndpoints(InetAddressAndPort target,
Replica a1,
Replica a2)
compares two endpoints in relation to the target endpoint, returning as Comparator.compare would
|
java.util.List<java.lang.Double> |
dumpTimings(java.lang.String hostname) |
double |
getBadnessThreshold() |
java.lang.String |
getDatacenter(InetAddressAndPort endpoint)
returns a String representing the datacenter the given endpoint belongs to
|
java.lang.String |
getRack(InetAddressAndPort endpoint)
returns a String representing the rack the given endpoint belongs to
|
int |
getResetInterval() |
java.util.Map<java.net.InetAddress,java.lang.Double> |
getScores() |
java.util.Map<java.lang.String,java.lang.Double> |
getScoresWithPort() |
double |
getSeverity() |
java.lang.String |
getSubsnitchClassName() |
int |
getUpdateInterval() |
void |
gossiperStarting()
called after Gossiper instance exists immediately before it starts gossiping
|
boolean |
isWorthMergingForRangeQuery(ReplicaCollection<?> merged,
ReplicaCollection<?> l1,
ReplicaCollection<?> l2)
Returns whether for a range query doing a query against merged is likely
to be faster than 2 sequential queries, one against l1 followed by one against l2.
|
void |
receiveTiming(InetAddressAndPort host,
long latency,
java.util.concurrent.TimeUnit unit) |
void |
setSeverity(double severity)
Setting a Severity allows operators to inject preference information into the Dynamic Snitch
replica selection.
|
<C extends ReplicaCollection<? extends C>> |
sortedByProximity(InetAddressAndPort address,
C unsortedAddresses)
Sorts the Collection of node addresses by proximity to the given address
|
boolean |
validate(java.util.Set<java.lang.String> datacenters,
java.util.Set<java.lang.String> racks)
Determine if the datacenter or rack values in the current node's snitch conflict with those passed in parameters.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDatacenter, getDatacenter, getLocalDatacenter, getLocalRack
public final IEndpointSnitch subsnitch
public DynamicEndpointSnitch(IEndpointSnitch snitch)
public DynamicEndpointSnitch(IEndpointSnitch snitch, java.lang.String instance)
public void applyConfigChanges()
DatabaseDescriptor
and estart the update-scheduler and reset-scheduler tasks
if the configured rates for these tasks have changed.public void close()
public void gossiperStarting()
IEndpointSnitch
gossiperStarting
in interface IEndpointSnitch
gossiperStarting
in class AbstractEndpointSnitch
public java.lang.String getRack(InetAddressAndPort endpoint)
IEndpointSnitch
getRack
in interface IEndpointSnitch
public java.lang.String getDatacenter(InetAddressAndPort endpoint)
IEndpointSnitch
getDatacenter
in interface IEndpointSnitch
public <C extends ReplicaCollection<? extends C>> C sortedByProximity(InetAddressAndPort address, C unsortedAddresses)
AbstractEndpointSnitch
sortedByProximity
in interface IEndpointSnitch
sortedByProximity
in class AbstractEndpointSnitch
address
- the address to sort by proximity tounsortedAddresses
- the nodes to sortpublic int compareEndpoints(InetAddressAndPort target, Replica a1, Replica a2)
IEndpointSnitch
compareEndpoints
in interface IEndpointSnitch
compareEndpoints
in class AbstractEndpointSnitch
public void receiveTiming(InetAddressAndPort host, long latency, java.util.concurrent.TimeUnit unit)
receiveTiming
in interface LatencySubscribers.Subscriber
public java.util.Map<java.net.InetAddress,java.lang.Double> getScores()
getScores
in interface DynamicEndpointSnitchMBean
public java.util.Map<java.lang.String,java.lang.Double> getScoresWithPort()
getScoresWithPort
in interface DynamicEndpointSnitchMBean
public int getUpdateInterval()
getUpdateInterval
in interface DynamicEndpointSnitchMBean
public int getResetInterval()
getResetInterval
in interface DynamicEndpointSnitchMBean
public double getBadnessThreshold()
getBadnessThreshold
in interface DynamicEndpointSnitchMBean
public java.lang.String getSubsnitchClassName()
getSubsnitchClassName
in interface DynamicEndpointSnitchMBean
public java.util.List<java.lang.Double> dumpTimings(java.lang.String hostname) throws java.net.UnknownHostException
dumpTimings
in interface DynamicEndpointSnitchMBean
java.net.UnknownHostException
public void setSeverity(double severity)
DynamicEndpointSnitchMBean
setSeverity
in interface DynamicEndpointSnitchMBean
public double getSeverity()
getSeverity
in interface DynamicEndpointSnitchMBean
public boolean isWorthMergingForRangeQuery(ReplicaCollection<?> merged, ReplicaCollection<?> l1, ReplicaCollection<?> l2)
IEndpointSnitch
isWorthMergingForRangeQuery
in interface IEndpointSnitch
isWorthMergingForRangeQuery
in class AbstractEndpointSnitch
public boolean validate(java.util.Set<java.lang.String> datacenters, java.util.Set<java.lang.String> racks)
IEndpointSnitch
validate
in interface IEndpointSnitch
Copyright © 2009- The Apache Software Foundation