hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r1125919 - in /incubator/hama/trunk: ./ src/java/org/apache/hama/bsp/ src/java/org/apache/hama/zookeeper/
Date Sun, 22 May 2011 11:38:45 GMT
Author: edwardyoon
Date: Sun May 22 11:38:45 2011
New Revision: 1125919

URL: http://svn.apache.org/viewvc?rev=1125919&view=rev
Log:
Refactor Exception.printStackTrace() to LOG.error(Exception)

Modified:
    incubator/hama/trunk/CHANGES.txt
    incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPMessageBundle.java
    incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPPeer.java
    incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPTask.java
    incubator/hama/trunk/src/java/org/apache/hama/bsp/JobInProgress.java
    incubator/hama/trunk/src/java/org/apache/hama/bsp/LocalBSPRunner.java
    incubator/hama/trunk/src/java/org/apache/hama/zookeeper/QuorumPeer.java

Modified: incubator/hama/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/CHANGES.txt?rev=1125919&r1=1125918&r2=1125919&view=diff
==============================================================================
--- incubator/hama/trunk/CHANGES.txt (original)
+++ incubator/hama/trunk/CHANGES.txt Sun May 22 11:38:45 2011
@@ -9,6 +9,7 @@ Release 0.3 - Unreleased
     
   BUG FIXES
 
+    HAMA-391: Refactor Exception.printStackTrace() to LOG.error(Exception) (Thomas Jungblut
via edwardyoon)
     HAMA-393: Add environment variable 'HAMA_HEAPSIZE' to hama-env.sh (edwardyoon)
     
   IMPROVEMENTS

Modified: incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPMessageBundle.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPMessageBundle.java?rev=1125919&r1=1125918&r2=1125919&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPMessageBundle.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPMessageBundle.java Sun May 22 11:38:45
2011
@@ -26,6 +26,8 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map.Entry;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.util.ReflectionUtils;
 
@@ -35,6 +37,8 @@ import org.apache.hadoop.util.Reflection
  * 
  */
 public class BSPMessageBundle implements Writable {
+  
+  public static final Log LOG = LogFactory.getLog(BSPMessageBundle.class);
 
   private HashMap<String, LinkedList<BSPMessage>> messages = new HashMap<String,
LinkedList<BSPMessage>>();
   private HashMap<String, Class<? extends BSPMessage>> classCache = new HashMap<String,
Class<? extends BSPMessage>>();
@@ -103,7 +107,7 @@ public class BSPMessageBundle implements
             clazz = (Class<? extends BSPMessage>) Class.forName(className);
             classCache.put(className, clazz);
           } catch (ClassNotFoundException e) {
-            e.printStackTrace();
+            LOG.error("Class was not found.",e);
           }
         }
 

Modified: incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPPeer.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPPeer.java?rev=1125919&r1=1125918&r2=1125919&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPPeer.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPPeer.java Sun May 22 11:38:45 2011
@@ -47,6 +47,7 @@ import org.apache.zookeeper.data.Stat;
  * This class represents a BSP peer.
  */
 public class BSPPeer implements Watcher, BSPPeerInterface {
+  
   public static final Log LOG = LogFactory.getLog(BSPPeer.class);
 
   private Configuration conf;
@@ -100,13 +101,13 @@ public class BSPPeer implements Watcher,
       LOG.info(" BSPPeer address:" + peerAddress.getHostName() + " port:"
           + peerAddress.getPort());
     } catch (IOException e) {
-      e.printStackTrace();
+      LOG.error("Exception during reinitialization!", e);
     }
 
     try {
       zk = new ZooKeeper(zookeeperAddr, 3000, this);
     } catch (IOException e) {
-      e.printStackTrace();
+      LOG.error("Exception during reinitialization!", e);
     }
 
     Stat s = null;
@@ -114,7 +115,7 @@ public class BSPPeer implements Watcher,
       try {
         s = zk.exists(Constants.DEFAULT_ZOOKEEPER_ROOT, false);
       } catch (Exception e) {
-        LOG.error(s);
+        LOG.error(s,e);
       }
 
       if (s == null) {
@@ -217,9 +218,9 @@ public class BSPPeer implements Watcher,
       zk.create(bspRoot + "/" + getPeerName(), new byte[0],
           Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
     } catch (KeeperException e) {
-      e.printStackTrace();
+      LOG.error("Exception while entering barrier!", e);
     } catch (InterruptedException e) {
-      e.printStackTrace();
+      LOG.error("Exception while entering barrier!", e);
     }
 
     while (true) {
@@ -240,9 +241,9 @@ public class BSPPeer implements Watcher,
       zk.create(bspRoot + "/" + getPeerName() + "-data", new byte[0],
           Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
     } catch (KeeperException e) {
-      e.printStackTrace();
+      LOG.error("Exception while waiting for barrier sync!", e);
     } catch (InterruptedException e) {
-      e.printStackTrace();
+      LOG.error("Exception while waiting for barrier sync!", e);
     }
 
     while (true) {

Modified: incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPTask.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPTask.java?rev=1125919&r1=1125918&r2=1125919&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPTask.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPTask.java Sun May 22 11:38:45 2011
@@ -19,6 +19,8 @@ package org.apache.hama.bsp;
 
 import java.io.IOException;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.util.ReflectionUtils;
 import org.apache.zookeeper.KeeperException;
 
@@ -26,6 +28,9 @@ import org.apache.zookeeper.KeeperExcept
  * Base class for tasks. 
  */
 public class BSPTask extends Task {
+  
+  public static final Log LOG = LogFactory.getLog(BSPTask.class);
+  
   private BSPJob conf;
   
   public BSPTask() {
@@ -53,14 +58,11 @@ public class BSPTask extends Task {
     try {
       bsp.bsp(umbilical);
     } catch (IOException e) {
-      // TODO Auto-generated catch block
-      e.printStackTrace();
+      LOG.error("Exception during BSP execution!", e);
     } catch (KeeperException e) {
-      // TODO Auto-generated catch block
-      e.printStackTrace();
+      LOG.error("Exception during BSP execution!", e);
     } catch (InterruptedException e) {
-      // TODO Auto-generated catch block
-      e.printStackTrace();
+      LOG.error("Exception during BSP execution!", e);
     }
 
     done(umbilical);

Modified: incubator/hama/trunk/src/java/org/apache/hama/bsp/JobInProgress.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/bsp/JobInProgress.java?rev=1125919&r1=1125918&r2=1125919&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/bsp/JobInProgress.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/bsp/JobInProgress.java Sun May 22 11:38:45
2011
@@ -32,6 +32,7 @@ import org.apache.hadoop.fs.Path;
  * tables for doing bookkeeping of its Tasks.ss
  */
 class JobInProgress {
+  
   /**
    * Used when the a kill is issued to a job which is initializing.
    */
@@ -208,7 +209,7 @@ class JobInProgress {
       }
 
     } catch (IOException e) {
-      e.printStackTrace();
+      LOG.error("Exception while obtaining new task!", e);
     }
     return result;
   }

Modified: incubator/hama/trunk/src/java/org/apache/hama/bsp/LocalBSPRunner.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/bsp/LocalBSPRunner.java?rev=1125919&r1=1125918&r2=1125919&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/bsp/LocalBSPRunner.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/bsp/LocalBSPRunner.java Sun May 22 11:38:45
2011
@@ -32,6 +32,8 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.concurrent.ThreadPoolExecutor;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.util.ReflectionUtils;
@@ -46,6 +48,8 @@ import org.apache.zookeeper.KeeperExcept
  * 
  */
 public class LocalBSPRunner implements JobSubmissionProtocol {
+  
+  public static final Log LOG = LogFactory.getLog(LocalBSPRunner.class);
 
   private static final String IDENTIFIER = "localrunner";
   private static String WORKING_DIR = "/user/hama/bsp/";
@@ -197,7 +201,7 @@ public class LocalBSPRunner implements J
       try {
         bsp.bsp(groom);
       } catch (Exception e) {
-        e.printStackTrace();
+        LOG.error("Exception during BSP execution!",e);
       }
     }
 
@@ -224,10 +228,10 @@ public class LocalBSPRunner implements J
         try {
           future.get();
         } catch (InterruptedException e) {
-          e.printStackTrace();
+          LOG.error("Exception during BSP execution!",e);
           success = false;
         } catch (ExecutionException e) {
-          e.printStackTrace();
+          LOG.error("Exception during BSP execution!",e);
           success = false;
         }
       }

Modified: incubator/hama/trunk/src/java/org/apache/hama/zookeeper/QuorumPeer.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/zookeeper/QuorumPeer.java?rev=1125919&r1=1125918&r2=1125919&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/zookeeper/QuorumPeer.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/zookeeper/QuorumPeer.java Sun May 22 11:38:45
2011
@@ -71,7 +71,7 @@ public class QuorumPeer implements Const
       zkConfig.parseProperties(zkProperties);
       runZKServer(zkConfig);
     } catch (Exception e) {
-      e.printStackTrace();
+      LOG.error("Exception during ZooKeeper startup - exiting...",e);
       System.exit(-1);
     }
   }



Mime
View raw message