import compbio.stat.collector.ExecutionStatCollector;\r
import compbio.stat.collector.StatDB;\r
import compbio.util.PropertyHelper;\r
+import compbio.util.Util;\r
\r
public class StatisticCollector implements ServletContextListener {\r
\r
int clusterMaxRuntime = getClusterJobTimeOut();\r
\r
int localMaxRuntime = getLocalJobTimeOut();\r
- String localWorkDir = getLocalJobDir();\r
+ String localWorkDir = compbio.engine.client.Util\r
+ .convertToAbsolute(getLocalJobDir());\r
\r
log.info("Initializing statistics collector");\r
- executor = Executors.newScheduledThreadPool(1);\r
+ executor = Executors.newScheduledThreadPool(2);\r
\r
if (collectClusterStats()) {\r
+ // TODO remove work out of the constructor Tomcat takes ages to\r
+ // start!\r
ExecutionStatCollector clusterCollector = new ExecutionStatCollector(\r
clusterWorkDir, clusterMaxRuntime);\r
clustercf = executor.scheduleAtFixedRate(clusterCollector, 60,\r
24 * 60, TimeUnit.MINUTES);\r
+ // clustercf = executor.scheduleAtFixedRate(clusterCollector, 15,\r
+ // 30,\r
+ // TimeUnit.SECONDS);\r
log.info("Collecting cluster statistics ");\r
+ } else {\r
+ log.info("Cluster statistics collector is disabled or not configured! ");\r
}\r
if (collectLocalStats()) {\r
ExecutionStatCollector localCollector = new ExecutionStatCollector(\r
localWorkDir, localMaxRuntime);\r
+ // localcf = executor.scheduleAtFixedRate(localCollector, 100, 60,\r
+ // TimeUnit.SECONDS);\r
+\r
localcf = executor.scheduleAtFixedRate(localCollector, 10, 24 * 60,\r
TimeUnit.MINUTES);\r
log.info("Collecting local statistics ");\r
+ } else {\r
+ log.info("Local statistics collector is disabled or not configured! ");\r
}\r
\r
}\r
}\r
\r
private static String getStringProperty(String propName) {\r
- String locdir = ph.getProperty(propName);\r
- if (locdir != null) {\r
- locdir = locdir.trim();\r
+ if (propName != null) {\r
+ propName = propName.trim();\r
}\r
- return locdir;\r
+ return propName;\r
}\r
\r
static boolean collectClusterStats() {\r
return getBooleanProperty(ph\r
.getProperty("cluster.stat.collector.enable"));\r
-\r
}\r
\r
static boolean collectLocalStats() {\r
return getBooleanProperty(ph.getProperty("local.stat.collector.enable"));\r
}\r
\r
- private static boolean getBooleanProperty(String propName) {\r
+ private static boolean getBooleanProperty(String propValue) {\r
boolean enabled = false;\r
- if (propName != null) {\r
- propName = propName.trim();\r
- enabled = Boolean.parseBoolean(propName);\r
+ if (!Util.isEmpty(propValue)) {\r
+ propValue = propValue.trim();\r
+ enabled = Boolean.parseBoolean(propValue);\r
}\r
return enabled;\r
}\r