public static void main(String[] args) throws Exception {
JedisPool pool = new JedisPoolBuilder().setDirectHostAndPort("localhost", "6379").setPoolSize(1).buildPool();
try {
MasterElector masterElector = new MasterElector(pool, 5);
masterElector.start();
System.out.println("Hit enter to stop.");
while (true) {
char c = (char) System.in.read();
if (c == '\n') {
System.out.println("Shuting down");
masterElector.stop();
return;
}
}
} finally {
pool.destroy();