1.1 --- a/statistics/src/main/java/cz/xelfi/quoridor/statistics/resources/Statistics.java Wed Jan 13 16:54:13 2010 +0100
1.2 +++ b/statistics/src/main/java/cz/xelfi/quoridor/statistics/resources/Statistics.java Wed Jan 13 16:55:20 2010 +0100
1.3 @@ -81,10 +81,16 @@
1.4 System.setProperty("quoridor.dir", quoridor.getPath());
1.5 }
1.6
1.7 + long lastExec = System.currentTimeMillis();
1.8 processGames();
1.9 HttpServer s = start(port);
1.10 System.out.println("Statistics started at port " + port);
1.11 Object monitor = new Object();
1.12 + // Wait until begining of next period. If timeout is one day, then next
1.13 + // processing will be done after midnight
1.14 + synchronized (monitor) {
1.15 + monitor.wait(timeout - (lastExec % timeout));
1.16 + }
1.17 for(;;){
1.18 synchronized (monitor) {
1.19 monitor.wait(timeout);