officedrop/jedis_failover — pull request #2 by JackyWoo (2013-09-06 06:59:40+00:00)
Title: addons an bug fix

Update log:
1 add some note in Chinese
2 support redis pipeline
3 fix a fatal bug

bug info:
presentation：too many CLOSE_WAIT TCP connections
cause: socket in client doesn't close when pool collects connection object.
classes related: com.officedrop.redis.failover.Client

code related:
private void quitMaster() {
if (this.master != null && master.isConnected()) {
try {
this.master.quit();
} catch (Exception e) {
log.error("Failed while closing the connection to master", e);
}
try{
this.master.disconnect();
} catch (Exception e) {
log.error("Failed while closing the connection to master", e);
}
}
}

private void quitSlaves() {
if (this.slaves != null) {
for (JedisClient slave : this.slaves) {
if(!slave.isConnected()) continue;
try {
slave.quit();
} catch (Exception e) {
log.error("Failed while closing the connection to the slave", e);
}
try{
slave.disconnect();
} catch (Exception e) {
log.error("Failed while closing the connection to the slave", e);
}
}
}
}