[clusterfest commit] r226 - in trunk: lib src/com/flaptor/clusterfest/monitoring src/com/flaptor/clusterfest/monitorin...

0 views
Skip to first unread message

codesite...@google.com

unread,
Jul 14, 2008, 5:15:03 PM7/14/08
to clust...@googlegroups.com
Author: martinmassera
Date: Mon Jul 14 14:14:30 2008
New Revision: 226

Modified:
trunk/lib/flaptor-util-trunk.jar
trunk/src/com/flaptor/clusterfest/monitoring/MonitorModule.java
trunk/src/com/flaptor/clusterfest/monitoring/MonitorNodeDescriptor.java
trunk/src/com/flaptor/clusterfest/monitoring/node/MonitoreableImplementation.java

Log:
clusterfest now has default logs per node type
shorter error message when logs are not found

Modified: trunk/lib/flaptor-util-trunk.jar
==============================================================================
Binary files. No diff available.

Modified: trunk/src/com/flaptor/clusterfest/monitoring/MonitorModule.java
==============================================================================
--- trunk/src/com/flaptor/clusterfest/monitoring/MonitorModule.java (original)
+++ trunk/src/com/flaptor/clusterfest/monitoring/MonitorModule.java Mon
Jul 14 14:14:30 2008
@@ -59,7 +59,6 @@
private static final Logger logger = Logger.getLogger(com.flaptor.util.Execute.whoAmI());

private final Map<String, PropertyFormatter> formatters = new
HashMap<String, PropertyFormatter>();
- private List<String>initialLogs;

File statesDir;

@@ -72,20 +71,20 @@
} catch (IOException e) {
throw new RuntimeException(e);
}
-
- initialLogs=Arrays.asList(cfg.getStringArray("clustering.monitor.logs.defaults"));
}


@Override
protected MonitorNodeDescriptor createModuleNode(NodeDescriptor node) {
- MonitorNodeDescriptor monitorNode = new MonitorNodeDescriptor(node,
statesDir, initialLogs);
+ MonitorNodeDescriptor monitorNode = new MonitorNodeDescriptor(node,
statesDir, new ArrayList<String>());
try {
monitorNode.setChecker(getCheckerForType(node.getType()));
+ monitorNode.addLogs(getLogsForType(node.getType()));
} catch (Exception e) {
logger.error(e);
throw new RuntimeException(e);
}
+
updateNodeInfo(monitorNode);
return monitorNode;
}
@@ -147,16 +146,30 @@
* @throws IllegalAccessException
* @throws ClassNotFoundException
*/
- private NodeChecker getCheckerForType(String type) {
- Config config = Config.getConfig("clustering.properties");
- try {
- String clazz = config.getString("clustering.monitor.checker."+type);
- if (clazz == null) clazz = config.getString("clustering.monitor.checker");
+ private NodeChecker getCheckerForType(String type) {
+ Config config = Config.getConfig("clustering.properties");
+ try {
+ String clazz = config.getString("clustering.monitor.checker."+type);
+ if (clazz == null) clazz = config.getString("clustering.monitor.checker");
return (NodeChecker) ClassUtil.instance(clazz);
- }catch (Throwable t) {
- logger.error(t);
- return null;
- }
+ }catch (Throwable t) {
+ logger.error(t);
+ return null;
+ }
+ }
+
+ private List<String> getLogsForType(String type) {
+ Config config = Config.getConfig("clustering.properties");
+ List<String> ret = new ArrayList<String>();
+ ret.addAll(Arrays.asList(config.getStringArray("clustering.monitor.logs.defaults")));
+ try {
+ String property = "clustering.monitor.logs."+type;
+ ret.addAll(Arrays.asList(config.getStringArray(property)));
+ }catch (Throwable t) {
+ t.printStackTrace();
+ logger.warn(t);
+ }
+ return ret;
}

/**

Modified: trunk/src/com/flaptor/clusterfest/monitoring/MonitorNodeDescriptor.java
==============================================================================
---
trunk/src/com/flaptor/clusterfest/monitoring/MonitorNodeDescriptor.java (original)
+++
trunk/src/com/flaptor/clusterfest/monitoring/MonitorNodeDescriptor.java
Mon Jul 14 14:14:30 2008
@@ -66,9 +66,7 @@
this.logs = new HashMap<String, Pair<String,Long>>();
this.monitoreable = MonitorModule.getModuleListener(node.getXmlrpcClient());

- for (String log : logNames) {
- this.logs.put(log, null);
- }
+ addLogs(logNames);
}

public List<NodeState> getStates() {
@@ -83,6 +81,12 @@
else return null;
}

+ public void addLogs(List<String> logNames) {
+ for (String logname: logNames) {
+ if (!logs.containsKey(logname)) logs.put(logname, null);
+ }
+ }
+
public Map<String, Pair<String, Long>> getLogs() {
return logs;
}

Modified: trunk/src/com/flaptor/clusterfest/monitoring/node/MonitoreableImplementation.java
==============================================================================
---
trunk/src/com/flaptor/clusterfest/monitoring/node/MonitoreableImplementation.java (original)
+++
trunk/src/com/flaptor/clusterfest/monitoring/node/MonitoreableImplementation.java
Mon Jul 14 14:14:30 2008
@@ -82,7 +82,7 @@
return IOUtil.readAll(new FileReader(logFile));
}
} catch (IOException e) {
- logger.warn(errorMessage, e);
+ logger.warn(errorMessage);
return errorMessage + " - " + e;
}
}

Reply all
Reply to author
Forward
0 new messages