HashedWheelTimer while interval calculation fixed. #198

pull/243/head
Nikita 10 years ago
parent b3b2629de2
commit 4b88e8ab2b

@ -59,7 +59,7 @@ public class MasterSlaveConnectionManager implements ConnectionManager {
private final Logger log = LoggerFactory.getLogger(getClass());
private final HashedWheelTimer timer = new HashedWheelTimer();
private HashedWheelTimer timer;
protected Codec codec;
@ -111,10 +111,25 @@ public class MasterSlaveConnectionManager implements ConnectionManager {
protected void init(MasterSlaveServersConfig config) {
this.config = config;
int minTimeout = Math.min(config.getRetryInterval(), config.getTimeout());
if (minTimeout % 100 != 0) {
timer = new HashedWheelTimer(minTimeout % 100, TimeUnit.MILLISECONDS);
} else {
timer = new HashedWheelTimer(100, TimeUnit.MILLISECONDS);
}
initEntry(config);
}
protected void initEntry(MasterSlaveServersConfig config) {
MasterSlaveEntry entry = new MasterSlaveEntry(codec, this, config);
entries.put(Integer.MAX_VALUE, entry);
}
public static void main(String[] args) {
System.out.println(1210 % 100);
}
protected void init(Config cfg) {
if (cfg.isUseLinuxNativeEpoll()) {
this.group = new EpollEventLoopGroup(cfg.getThreads());

@ -39,12 +39,9 @@ public class SingleConnectionManager extends MasterSlaveConnectionManager {
}
@Override
protected void init(MasterSlaveServersConfig config) {
this.config = config;
protected void initEntry(MasterSlaveServersConfig config) {
SingleEntry entry = new SingleEntry(codec, this, config);
entries.put(Integer.MAX_VALUE, entry);
}
}

Loading…
Cancel
Save