[clusterfest commit] r237 - in trunk: lib src/com/flaptor/clusterfest src/com/flaptor/clusterfest/action src/com/flapt...

0 views
Skip to first unread message

codesite...@google.com

unread,
Jul 23, 2008, 2:12:54 PM7/23/08
to clust...@googlegroups.com
Author: martinmassera
Date: Wed Jul 23 11:11:58 2008
New Revision: 237

Modified:
trunk/lib/flaptor-util-trunk.jar
trunk/src/com/flaptor/clusterfest/ModuleUtil.java
trunk/src/com/flaptor/clusterfest/NodeDescriptor.java
trunk/src/com/flaptor/clusterfest/action/ActionNodeDescriptor.java
trunk/src/com/flaptor/clusterfest/monitoring/MonitorNodeDescriptor.java

Log:
mooooore logging in clusterfest

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

Modified: trunk/src/com/flaptor/clusterfest/ModuleUtil.java
==============================================================================
--- trunk/src/com/flaptor/clusterfest/ModuleUtil.java (original)
+++ trunk/src/com/flaptor/clusterfest/ModuleUtil.java Wed Jul 23
11:11:58 2008
@@ -5,6 +5,8 @@

import javax.servlet.http.HttpServletRequest;

+import org.apache.log4j.Logger;
+
import com.flaptor.clusterfest.exceptions.NodeException;
import com.flaptor.util.CallableWithId;
import com.flaptor.util.Pair;
@@ -18,6 +20,7 @@
*/
public class ModuleUtil {

+ private static final Logger logger = Logger.getLogger(com.flaptor.util.Execute.whoAmI());
/**
* determines if the node belongs to the module
* the node must implement the Pingable interface in the module context
@@ -35,7 +38,7 @@
} catch (NoSuchRpcMethodException e) {
return false;
} catch (Throwable t) {
- node.checkAndThrow(t);
+ node.checkAndThrow(t, logger);
return false; //never called
}
}

Modified: trunk/src/com/flaptor/clusterfest/NodeDescriptor.java
==============================================================================
--- trunk/src/com/flaptor/clusterfest/NodeDescriptor.java (original)
+++ trunk/src/com/flaptor/clusterfest/NodeDescriptor.java Wed Jul 23
11:11:58 2008
@@ -19,9 +19,12 @@
import java.net.MalformedURLException;
import java.net.URL;

+import org.apache.log4j.Logger;
+
import com.flaptor.clusterfest.exceptions.NodeCodeException;
import com.flaptor.clusterfest.exceptions.NodeException;
import com.flaptor.clusterfest.exceptions.NodeUnreachableException;
+import com.flaptor.util.Execute;
import com.flaptor.util.remote.RemoteHostCodeException;
import com.flaptor.util.remote.RpcConnectionException;
import com.flaptor.util.remote.XmlrpcClient;
@@ -36,6 +39,8 @@
*/
public class NodeDescriptor {

+ private static final Logger logger = Logger.getLogger(com.flaptor.util.Execute.whoAmI());
+
private String host;
private int port;
private String installDir;
@@ -94,7 +99,7 @@
type = clusterableStub.getNodeType();
reachable = true;
} catch (Throwable t) {
- checkAndThrow(t);
+ checkAndThrow(t, logger);
}
}
public String toString() {
@@ -107,10 +112,11 @@
* @param t
* @throws NodeException
*/
- public void checkAndThrow(Throwable t) throws NodeException {
+ public void checkAndThrow(Throwable t, Logger logger) throws
NodeException {
+ if (logger != null) logger.error(t, t);
+
if (t instanceof RpcConnectionException) throw new
NodeUnreachableException(this, t);
else if (t instanceof RemoteHostCodeException) throw new
NodeCodeException(this, t);
- else if (t instanceof RuntimeException) throw (RuntimeException)t;
- else throw new RuntimeException("unexpected exception", t);
+ else Execute.runtimeOrError(t, logger);
}
}

Modified: trunk/src/com/flaptor/clusterfest/action/ActionNodeDescriptor.java
==============================================================================
--- trunk/src/com/flaptor/clusterfest/action/ActionNodeDescriptor.java (original)
+++ trunk/src/com/flaptor/clusterfest/action/ActionNodeDescriptor.java
Wed Jul 23 11:11:58 2008
@@ -1,5 +1,7 @@
package com.flaptor.clusterfest.action;

+import org.apache.log4j.Logger;
+
import com.flaptor.clusterfest.ModuleNodeDescriptor;
import com.flaptor.clusterfest.NodeDescriptor;
import com.flaptor.clusterfest.exceptions.NodeException;
@@ -10,6 +12,7 @@
*/
public class ActionNodeDescriptor extends ModuleNodeDescriptor{

+ private static final Logger logger = Logger.getLogger(com.flaptor.util.Execute.whoAmI());
private ActionReceiver receiver;

public ActionNodeDescriptor(NodeDescriptor nodeDescriptor) {
@@ -26,7 +29,7 @@
try {
receiver.action(action, params);
} catch (Throwable t) {
- getNodeDescriptor().checkAndThrow(t);
+ getNodeDescriptor().checkAndThrow(t, logger);
}
}
}

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 Jul 23 11:11:58 2008
@@ -135,7 +135,7 @@
getNodeDescriptor().setReachable(true);
logs.put(logName, new Pair<String, Long>(log, System.currentTimeMillis()));
} catch (Throwable t) {
- getNodeDescriptor().checkAndThrow(t);
+ getNodeDescriptor().checkAndThrow(t, logger);
}
}

@@ -229,7 +229,7 @@
getNodeDescriptor().setReachable(true);
return properties;
} catch (Throwable t) {
- getNodeDescriptor().checkAndThrow(t);
+ getNodeDescriptor().checkAndThrow(t, logger);
return null; //never called
}
}
@@ -240,7 +240,7 @@
getNodeDescriptor().setReachable(true);
return systemProperties;
} catch (Throwable t) {
- getNodeDescriptor().checkAndThrow(t);
+ getNodeDescriptor().checkAndThrow(t, logger);
return null; //never called
}
}

Reply all
Reply to author
Forward
0 new messages