/[projects]/android/TrainInfoService/src/dk/thoerup/traininfoservice/StatisticsListener.java
ViewVC logotype

Diff of /android/TrainInfoService/src/dk/thoerup/traininfoservice/StatisticsListener.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1022 by torben, Mon Aug 30 15:49:20 2010 UTC revision 1023 by torben, Mon Aug 30 15:53:09 2010 UTC
# Line 21  public class StatisticsListener implemen Line 21  public class StatisticsListener implemen
21                    
22          update_interval = getUpdateInterval( sce.getServletContext() );          update_interval = getUpdateInterval( sce.getServletContext() );
23                    
24          log.info("StatisticsListener::contextInit called update_interval=" + update_interval);          
25                    
26          if (! sce.getServletContext().getRealPath("/").startsWith("/home/app/")  ) {          if (! sce.getServletContext().getRealPath("/").startsWith("/home/app/")  ) {
27                  //if path not starts with /home/app then it is not running on a production server and we only collects stats on prod servers                  //if path not starts with /home/app then it is not running on a production server and we only collects stats on prod servers
28                    log.info("This is not a prod. server, dont start Statistics saver");
29                  return;                  return;
30          }          }
31                    
32            
33            
34          if ( update_interval > 0 ) {          if ( update_interval > 0 ) {
35                    log.info("Statistics saver started with update_interval=" + update_interval);
36                  timer =  new Timer();                  timer =  new Timer();
37                                    
38                  TimerTask statsUpdate = new TimerTask() {                  TimerTask statsUpdate = new TimerTask() {
# Line 39  public class StatisticsListener implemen Line 43  public class StatisticsListener implemen
43                  };                  };
44                                    
45                  timer.schedule(statsUpdate, 0, update_interval);                  timer.schedule(statsUpdate, 0, update_interval);
46            } else {
47                    log.info("Statistics saver disabled (update_interval == 0) ");
48          }          }
49      }      }
50    

Legend:
Removed from v.1022  
changed lines
  Added in v.1023

  ViewVC Help
Powered by ViewVC 1.1.20