HBASE-1074 New thread introduced by hbase-900 part 4 is not daemon so can cause JVM to stick around on abort

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@728384 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-12-21 03:52:11 +00:00
parent bac528818a
commit a23e45f4b7
4 changed files with 14 additions and 6 deletions

View File

@ -1524,7 +1524,6 @@ public class HTable {
} catch (IOException e) {
if (e instanceof UnknownScannerException &&
lastNext + scannerTimeout < System.currentTimeMillis()) {
ScannerTimeoutException ex = new ScannerTimeoutException();
ex.initCause(e);
throw ex;
@ -1538,7 +1537,6 @@ public class HTable {
countdown--;
}
}
} while (countdown > 0 && nextScanner(countdown));
}

View File

@ -24,6 +24,7 @@ import java.io.InputStream;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.Log;
@ -48,7 +49,15 @@ public class BlockFSInputStream extends FSInputStream {
* also want BlockFSInputStream to be self-contained.
*/
private static final ScheduledExecutorService EXECUTOR =
Executors.newSingleThreadScheduledExecutor();
Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
public Thread newThread(Runnable r) {
Thread t = new Thread(r);
t.setDaemon(true);
t.setName("BlockFSInputStream referenceQueue Checker");
return t;
}
});
/*
* The registration of this object in EXECUTOR.
@ -101,11 +110,12 @@ public class BlockFSInputStream extends FSInputStream {
}
};
// Register a Runnable that runs checkReferences on a period.
final int hashcode = hashCode();
this.registration = EXECUTOR.scheduleAtFixedRate(new Runnable() {
public void run() {
int cleared = checkReferences();
if (LOG.isDebugEnabled() && cleared > 0) {
LOG.debug("Cleared " + cleared);
LOG.debug("Cleared " + cleared + " in " + hashcode);
}
}
}, 10, 10, TimeUnit.SECONDS);

View File

@ -25,7 +25,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta http-equiv="refresh" content="30"/>
<meta http-equiv="refresh" content="300"/>
<title>HBase Master: <%= master.getMasterAddress().getHostname()%>:<%= master.getMasterAddress().getPort() %></title>
<link rel="stylesheet" type="text/css" href="/static/hbase.css" />
</head>

View File

@ -20,7 +20,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta http-equiv="refresh" content="30"/>
<meta http-equiv="refresh" content="300"/>
<title>HBase Region Server: <%= serverInfo.getServerAddress().getHostname() %>:<%= serverInfo.getServerAddress().getPort() %></title>
<link rel="stylesheet" type="text/css" href="/static/hbase.css" />
</head>