作者 crossoverJie

:recycle: Refactoring code.

... ... @@ -12,13 +12,10 @@ import java.util.List;
* @since JDK 1.8
*/
public class ConsistentHashHandle implements RouteHandle {
private AbstractConsistentHash hash = new SortArrayMapConsistentHash() ;
private AbstractConsistentHash hash = new SortArrayMapConsistentHash();
@Override
public String routeServer(List<String> values) {
String key = values.get(0);
values.remove(0) ;
hash.process(values);
return "";
return hash.process(values);
}
}
... ...
package com.crossoverjie.cim.route.config;
import com.crossoverjie.cim.common.route.algorithm.RouteHandle;
import com.crossoverjie.cim.common.route.algorithm.loop.LoopHandle;
import com.crossoverjie.cim.common.route.algorithm.consistenthash.ConsistentHashHandle;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
... ... @@ -78,6 +78,6 @@ public class BeanConfig {
@Bean
public RouteHandle buildRouteHandle(){
return new LoopHandle() ;
return new ConsistentHashHandle() ;
}
}
... ...