[clusterfest commit] r243 - in trunk: . src/com/flaptor/clusterfest/monitoring websrc/web-clusterfest

2 views
Skip to first unread message

codesite...@google.com

unread,
Aug 7, 2008, 2:21:29 PM8/7/08
to clust...@googlegroups.com
Author: martinmassera
Date: Wed Aug 6 13:08:25 2008
New Revision: 243

Modified:
trunk/build.xml
trunk/src/com/flaptor/clusterfest/monitoring/MonitorModule.java
trunk/src/com/flaptor/clusterfest/monitoring/MonitorNodeDescriptor.java
trunk/src/com/flaptor/clusterfest/monitoring/NodeState.java
trunk/websrc/web-clusterfest/monitorNode.vm

Log:
clusterfest with ids in node states
version number to 0.7-trunk

Modified: trunk/build.xml
==============================================================================
--- trunk/build.xml (original)
+++ trunk/build.xml Wed Aug 6 13:08:25 2008
@@ -16,7 +16,7 @@

<project name="clusterfest" default="jar" basedir=".">
<property name="project" value="clusterfest"/>
- <property name="version" value="0.6-trunk"/>
+ <property name="version" value="0.7-trunk"/>

<property name="src.dir" value="${basedir}/src"/>
<property name="websrc.dir" value="${basedir}/websrc"/>

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 Wed
Aug 6 13:08:25 2008
@@ -277,9 +277,9 @@
}
if (monitorNode != null) {
NodeState nodeState = null;
- String stateNum = request.getParameter("stateNum");
- if (stateNum != null) {
- nodeState =
monitorNode.getNodeState(Integer.parseInt(stateNum));
+ String stateID = request.getParameter("stateId");
+ if (stateID != null) {
+ nodeState =
monitorNode.getNodeState(Integer.parseInt(stateID));
} else {
nodeState = monitorNode.getLastState();
}

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
Wed Aug 6 13:08:25 2008
@@ -24,6 +24,7 @@
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
+import java.util.concurrent.atomic.AtomicLong;

import org.apache.log4j.Logger;

@@ -53,7 +54,10 @@
private NodeChecker checker;
private Monitoreable monitoreable;
private int logSize;
-
+
+ private static Object stateIdLock = new Object();
+ private static long maxStateId = 0;
+
FileSerializer stateFileSerializer;

@SuppressWarnings("unchecked")
@@ -66,6 +70,12 @@
states =
(List<NodeState>)stateFileSerializer.deserialize(true);
}
if (states == null) states = new ArrayList<NodeState>();
+ for (NodeState state : states) {
+ synchronized (stateIdLock) {
+ if (state.getStateId() > maxStateId) maxStateId =
state.getStateId();
+ }
+ }
+

logs = new HashMap<String, Pair<String,Long>>();
monitoreable =
MonitorModule.getModuleListener(node.getXmlrpcClient());
@@ -85,11 +95,11 @@
return states.size() > 0 ? states.get(states.size()-1) : null;
}
}
- public NodeState getNodeState(int stateNumber) {
- synchronized (states) {
- if (states.size() > stateNumber) return
states.get(stateNumber);
- else return null;
+ public NodeState getNodeState(long stateId) {
+ for (NodeState state : states) {
+ if (state.getStateId() == stateId) return state;
}
+ return null;
}

public void addLogs(List<String> logNames) {
@@ -169,7 +179,11 @@
state = NodeState.createClusterManagerErrorState(t);
} finally {
synchronized (states) {
- states.add(state);
+ synchronized (stateIdLock) {
+ maxStateId++;
+ state.setStateId(maxStateId);
+ }
+ states.add(state);

cleanupStateList();


Modified: trunk/src/com/flaptor/clusterfest/monitoring/NodeState.java
==============================================================================
--- trunk/src/com/flaptor/clusterfest/monitoring/NodeState.java (original)
+++ trunk/src/com/flaptor/clusterfest/monitoring/NodeState.java Wed Aug 6
13:08:25 2008
@@ -21,6 +21,8 @@
import java.io.StringWriter;
import java.util.Arrays;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;

/**
* The state of a node in the monitoring module
@@ -38,6 +40,7 @@
private Map<String, Object> properties;
private SystemProperties systemProperties;
private long timestamp;
+ private long stateId;

public static NodeState createUncheckedState() {
NodeState state = new NodeState(null, null);
@@ -69,9 +72,8 @@
state.sanity = new NodeChecker.Result(NodeChecker.Sanity.ERROR,
Arrays.asList(new String[]{"CLUSTER MANAGER throwing exception",
t.getMessage(), getStack(t)}));
return state;
}
-
+
public NodeState(Map<String, Object> properties, SystemProperties
systemProperties) {
- super();
// should be updated later by a NodeChecker
this.sanity = UNCHECKED_RESULT;

@@ -99,5 +101,13 @@
} else {
this.sanity = UNCHECKED_RESULT;
}
+ }
+
+ public long getStateId() {
+ return stateId;
+ }
+
+ public void setStateId(long stateId) {
+ this.stateId = stateId;
}
}

Modified: trunk/websrc/web-clusterfest/monitorNode.vm
==============================================================================
--- trunk/websrc/web-clusterfest/monitorNode.vm (original)
+++ trunk/websrc/web-clusterfest/monitorNode.vm Wed Aug 6 13:08:25 2008
@@ -59,7 +59,7 @@
#set ($state = $monitorNode.getStates().get($num))
<tr><td>
$state.getSanity().getSanity() at
- <a
href="monitorNode.do?idx=$idx&stateNum=$num">$dateUtil.toDate($state.getTimestamp())</a>
+ <a
href="monitorNode.do?idx=$idx&stateId=$state.getStateId()">$dateUtil.toDate($state.getTimestamp())</a>
</td></tr>
#end
</table>

Reply all
Reply to author
Forward
0 new messages