com.naah69.core.config.redisson.ClusterServersConfigs Maven / Gradle / Ivy
The newest version!
package com.naah69.core.config.redisson;
import org.redisson.config.ClusterServersConfig;
import org.redisson.connection.balancer.LoadBalancer;
import java.util.Map;
/**
* ClusterServersConfigs
*
* @author naah
*/
public class ClusterServersConfigs extends ClusterServersConfig {
private Map loadBalancer;
@Override
public LoadBalancer getLoadBalancer() {
if (this.loadBalancer != null) {
try {
String classStr = this.loadBalancer.get("class");
if (classStr != null && !classStr.equals("")) {
Class> clazz = Class.forName(classStr);
Object loadBalancer = clazz.newInstance();
if (loadBalancer instanceof LoadBalancer) {
return (LoadBalancer) loadBalancer;
}
}
} catch (Exception e) {
return null;
}
}
return null;
}
public void setLoadBalancer(Map loadBalancer) {
this.loadBalancer = loadBalancer;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy