HADOOP-11648. Set DomainSocketWatcher thread name explicitly. Contributed by Liang Xie.

(cherry picked from commit 74a4754d1c)
This commit is contained in:
Tsuyoshi Ozawa 2015-03-05 16:05:44 +09:00
parent ac874764d5
commit f805d48b19
6 changed files with 15 additions and 6 deletions

View File

@ -227,6 +227,9 @@ Release 2.7.0 - UNRELEASED
HADOOP-11658. Externalize io.compression.codecs property.
(Kai Zheng via aajisaka)
HADOOP-11648. Set DomainSocketWatcher thread name explicitly.
(Liang Xie via ozawa)
OPTIMIZATIONS
HADOOP-11323. WritableComparator#compare keeps reference to byte array.

View File

@ -238,7 +238,8 @@ public final class DomainSocketWatcher implements Closeable {
*/
private boolean kicked = false;
public DomainSocketWatcher(int interruptCheckPeriodMs) throws IOException {
public DomainSocketWatcher(int interruptCheckPeriodMs, String src)
throws IOException {
if (loadingFailureReason != null) {
throw new UnsupportedOperationException(loadingFailureReason);
}
@ -246,8 +247,9 @@ public final class DomainSocketWatcher implements Closeable {
this.interruptCheckPeriodMs = interruptCheckPeriodMs;
notificationSockets = DomainSocket.socketpair();
watcherThread.setDaemon(true);
watcherThread.setUncaughtExceptionHandler(
new Thread.UncaughtExceptionHandler() {
watcherThread.setName(src + " DomainSocketWatcher");
watcherThread
.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread thread, Throwable t) {
LOG.error(thread + " terminating on unexpected exception", t);

View File

@ -195,7 +195,7 @@ public class TestDomainSocketWatcher {
private DomainSocketWatcher newDomainSocketWatcher(int interruptCheckPeriodMs)
throws Exception {
DomainSocketWatcher watcher = new DomainSocketWatcher(
interruptCheckPeriodMs);
interruptCheckPeriodMs, getClass().getSimpleName());
watcher.watcherThread.setUncaughtExceptionHandler(
new Thread.UncaughtExceptionHandler() {
@Override

View File

@ -407,6 +407,9 @@ Release 2.7.0 - UNRELEASED
HDFS-7746. Add a test randomly mixing append, truncate and snapshot
operations. (szetszwo)
HADOOP-11648. Set DomainSocketWatcher thread name explicitly.
(Liang Xie via ozawa)
OPTIMIZATIONS
HDFS-7454. Reduce memory footprint for AclEntries in NameNode.

View File

@ -176,7 +176,7 @@ public class ShortCircuitRegistry {
if (dswLoadingFailure != null) {
throw new IOException(dswLoadingFailure);
}
watcher = new DomainSocketWatcher(interruptCheck);
watcher = new DomainSocketWatcher(interruptCheck, "datanode");
enabled = true;
if (LOG.isDebugEnabled()) {
LOG.debug("created new ShortCircuitRegistry with interruptCheck=" +

View File

@ -412,7 +412,8 @@ public class DfsClientShmManager implements Closeable {
private final DomainSocketWatcher domainSocketWatcher;
DfsClientShmManager(int interruptCheckPeriodMs) throws IOException {
this.domainSocketWatcher = new DomainSocketWatcher(interruptCheckPeriodMs);
this.domainSocketWatcher = new DomainSocketWatcher(interruptCheckPeriodMs,
"client");
}
public Slot allocSlot(DatanodeInfo datanode, DomainPeer peer,