private static ScheduledFuture statisticsTask;
public static void main(String[] args) throws Exception {
JedisPool pool = new JedisPoolBuilder().setDirectHostAndPort("localhost", "6379").setPoolSize(1).buildPool();
try {
JobDispatcher dispatcher = new JobDispatcher("ss", pool);
dispatcher.setReliable(true);
JobStatistics statistics = new JobStatistics("ss", pool);
startPrintStatistics(statistics);
dispatcher.start();
System.out.println("Hit enter to stop.");
while (true) {
char c = (char) System.in.read();
if (c == '\n') {
System.out.println("Shuting down");
dispatcher.stop();
stopPrintStatistics();
return;
}
}
} finally {
pool.destroy();
}
}