You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by jd...@apache.org on 2011/10/03 21:09:01 UTC
svn commit: r1178521 - in /hbase/branches/0.92: CHANGES.txt
src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java
src/test/java/org/apache/hadoop/hbase/executor/TestExecutorService.java
Author: jdcryans
Date: Mon Oct 3 19:09:00 2011
New Revision: 1178521
URL: http://svn.apache.org/viewvc?rev=1178521&view=rev
Log:
HBASE-4473 NPE when executors are down but events are still coming in
Modified:
hbase/branches/0.92/CHANGES.txt
hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java
hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/executor/TestExecutorService.java
Modified: hbase/branches/0.92/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/CHANGES.txt?rev=1178521&r1=1178520&r2=1178521&view=diff
==============================================================================
--- hbase/branches/0.92/CHANGES.txt (original)
+++ hbase/branches/0.92/CHANGES.txt Mon Oct 3 19:09:00 2011
@@ -665,6 +665,7 @@ Release 0.90.5 - Unreleased
HBASE-4295 rowcounter does not return the correct number of rows in
certain circumstances (David Revell)
HBASE-4515 User.getCurrent() can fail to initialize the current user
+ HBASE-4473 NPE when executors are down but events are still coming in
IMPROVEMENT
HBASE-4205 Enhance HTable javadoc (Eric Charles)
Modified: hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java?rev=1178521&r1=1178520&r2=1178521&view=diff
==============================================================================
--- hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java (original)
+++ hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java Mon Oct 3 19:09:00 2011
@@ -213,9 +213,6 @@ public class ExecutorService {
Executor getExecutor(String name) {
Executor executor = this.executorMap.get(name);
- if (executor == null) {
- LOG.debug("Executor service [" + name + "] not found in " + this.executorMap);
- }
return executor;
}
@@ -231,7 +228,16 @@ public class ExecutorService {
}
public void submit(final EventHandler eh) {
- getExecutor(getExecutorServiceType(eh.getEventType())).submit(eh);
+ Executor executor = getExecutor(getExecutorServiceType(eh.getEventType()));
+ if (executor == null) {
+ // This happens only when events are submitted after shutdown() was
+ // called, so dropping them should be "ok" since it means we're
+ // shutting down.
+ LOG.error("Cannot submit [" + eh + "] because the executor is missing." +
+ " Is this process shutting down?");
+ } else {
+ executor.submit(eh);
+ }
}
/**
Modified: hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/executor/TestExecutorService.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/executor/TestExecutorService.java?rev=1178521&r1=1178520&r2=1178521&view=diff
==============================================================================
--- hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/executor/TestExecutorService.java (original)
+++ hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/executor/TestExecutorService.java Mon Oct 3 19:09:00 2011
@@ -124,6 +124,15 @@ public class TestExecutorService {
// Make sure threads are still around even after their timetolive expires.
Thread.sleep(executor.keepAliveTimeInMillis * 2);
assertEquals(maxThreads, pool.getPoolSize());
+
+ executorService.shutdown();
+
+ assertEquals(0, executorService.getAllExecutorStatuses().size());
+
+ // Test that submit doesn't throw NPEs
+ executorService.submit(
+ new TestEventHandler(mockedServer, EventType.M_SERVER_SHUTDOWN,
+ lock, counter));
}
private void checkStatusDump(ExecutorStatus status) throws IOException {