com.netflix.astyanax.connectionpool.impl
Class SmaLatencyScoreStrategyImpl

java.lang.Object
  extended by com.netflix.astyanax.connectionpool.impl.SmaLatencyScoreStrategyImpl
All Implemented Interfaces:
LatencyScoreStrategy

public class SmaLatencyScoreStrategyImpl
extends Object
implements LatencyScoreStrategy


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.netflix.astyanax.connectionpool.LatencyScoreStrategy
LatencyScoreStrategy.Instance, LatencyScoreStrategy.Listener
 
Constructor Summary
SmaLatencyScoreStrategyImpl(ConnectionPoolConfiguration config)
           
SmaLatencyScoreStrategyImpl(ConnectionPoolConfiguration config, String name)
           
 
Method Summary
 LatencyScoreStrategy.Instance createInstance()
          Create a new instance to associate with an endpoint
 ConnectionPoolConfiguration getConfig()
           
 String getName()
           
protected  LatencyScoreStrategy.Instance internalCreateInstance()
           
 void removeInstance(LatencyScoreStrategy.Instance instance)
          Remove the instance for an endpoint that is no longer being tracked
 void reset()
          Reset all instance scores
 void shutdown()
          Shutdown the threads created by calling start()
<CL> List<HostConnectionPool<CL>>
sortAndfilterPartition(List<HostConnectionPool<CL>> srcPools, AtomicBoolean prioritized)
          Sorts and filters a list of hosts by looking at their up state and score.
 void start(LatencyScoreStrategy.Listener listener)
          Start updating stats for instances created using createInstance.
 String toString()
           
 void update(long now)
          Update all instance scores
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SmaLatencyScoreStrategyImpl

public SmaLatencyScoreStrategyImpl(ConnectionPoolConfiguration config)

SmaLatencyScoreStrategyImpl

public SmaLatencyScoreStrategyImpl(ConnectionPoolConfiguration config,
                                   String name)
Method Detail

internalCreateInstance

protected LatencyScoreStrategy.Instance internalCreateInstance()

createInstance

public final LatencyScoreStrategy.Instance createInstance()
Description copied from interface: LatencyScoreStrategy
Create a new instance to associate with an endpoint

Specified by:
createInstance in interface LatencyScoreStrategy
Returns:

start

public void start(LatencyScoreStrategy.Listener listener)
Description copied from interface: LatencyScoreStrategy
Start updating stats for instances created using createInstance. This usually spawns an update thread as well as a reset thread operating at configurable intervals

Specified by:
start in interface LatencyScoreStrategy

shutdown

public void shutdown()
Description copied from interface: LatencyScoreStrategy
Shutdown the threads created by calling start()

Specified by:
shutdown in interface LatencyScoreStrategy

removeInstance

public void removeInstance(LatencyScoreStrategy.Instance instance)
Description copied from interface: LatencyScoreStrategy
Remove the instance for an endpoint that is no longer being tracked

Specified by:
removeInstance in interface LatencyScoreStrategy

sortAndfilterPartition

public <CL> List<HostConnectionPool<CL>> sortAndfilterPartition(List<HostConnectionPool<CL>> srcPools,
                                                                AtomicBoolean prioritized)
Description copied from interface: LatencyScoreStrategy
Sorts and filters a list of hosts by looking at their up state and score.

Specified by:
sortAndfilterPartition in interface LatencyScoreStrategy
prioritized - - Will be set to true if the filtered data is prioritized or not. If prioritized then the first element should be selected from by the load balancing strategy. Otherwise round robin could be used.
Returns:

getName

public String getName()

getConfig

public ConnectionPoolConfiguration getConfig()

toString

public String toString()
Overrides:
toString in class Object

update

public void update(long now)
Description copied from interface: LatencyScoreStrategy
Update all instance scores

Specified by:
update in interface LatencyScoreStrategy

reset

public void reset()
Description copied from interface: LatencyScoreStrategy
Reset all instance scores

Specified by:
reset in interface LatencyScoreStrategy


Copyright © 2012. All Rights Reserved.