From 16c92b7ce8d90fac02ab4e8b71fd7065b65860f7 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Mon, 18 May 2009 19:59:43 +0000 Subject: [PATCH] HBASE-1386 NPE in housekeeping -- part 2 git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@776067 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/hadoop/hbase/regionserver/HRegionServer.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index 39adf75573e..c3027e081c5 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -1388,11 +1388,10 @@ public class HRegionServer implements HConstants, HRegionInterface, * Data structure to hold a HMsg and retries count. */ private static final class ToDoEntry { - protected volatile int tries; + protected final AtomicInteger tries = new AtomicInteger(0); protected final HMsg msg; ToDoEntry(final HMsg msg) { - this.tries = 0; this.msg = msg; } } @@ -1487,9 +1486,9 @@ public class HRegionServer implements HConstants, HRegionInterface, if (ex instanceof IOException) { ex = RemoteExceptionHandler.checkIOException((IOException) ex); } - if(e != null && e.tries < numRetries) { + if(e != null && e.tries.get() < numRetries) { LOG.warn(ex); - e.tries++; + e.tries.incrementAndGet(); try { toDo.put(e); } catch (InterruptedException ie) {