diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/monkies/PolicyBasedChaosMonkey.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/monkies/PolicyBasedChaosMonkey.java index 9152cb2a3a0..57f7c836495 100644 --- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/monkies/PolicyBasedChaosMonkey.java +++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/monkies/PolicyBasedChaosMonkey.java @@ -113,7 +113,7 @@ public class PolicyBasedChaosMonkey extends ChaosMonkey { for (int i=0; i queue) { + super("BucketCacheWriterThread"); this.inputQueue = queue; } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index ba067e7f386..1845c08dad7 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -673,7 +673,8 @@ public class HMaster extends HRegionServer implements MasterServices, Server { throws IOException, InterruptedException, KeeperException, CoordinatedStateException { isActiveMaster = true; - Thread zombieDetector = new Thread(new InitializationMonitor(this)); + Thread zombieDetector = new Thread(new InitializationMonitor(this), + "ActiveMasterInitializationMonitor-" + System.currentTimeMillis()); zombieDetector.start(); /* diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java index 4ba07bfcffb..6f95a098c7e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java @@ -124,9 +124,8 @@ public class CompactSplitThread implements CompactionRequestor, PropagatingConfi new ThreadFactory() { @Override public Thread newThread(Runnable r) { - Thread t = new Thread(r); - t.setName(n + "-longCompactions-" + System.currentTimeMillis()); - return t; + String name = n + "-longCompactions-" + System.currentTimeMillis(); + return new Thread(r, name); } }); this.longCompactions.setRejectedExecutionHandler(new Rejection()); @@ -136,9 +135,8 @@ public class CompactSplitThread implements CompactionRequestor, PropagatingConfi new ThreadFactory() { @Override public Thread newThread(Runnable r) { - Thread t = new Thread(r); - t.setName(n + "-shortCompactions-" + System.currentTimeMillis()); - return t; + String name = n + "-shortCompactions-" + System.currentTimeMillis(); + return new Thread(r, name); } }); this.shortCompactions @@ -148,9 +146,8 @@ public class CompactSplitThread implements CompactionRequestor, PropagatingConfi new ThreadFactory() { @Override public Thread newThread(Runnable r) { - Thread t = new Thread(r); - t.setName(n + "-splits-" + System.currentTimeMillis()); - return t; + String name = n + "-splits-" + System.currentTimeMillis(); + return new Thread(r, name); } }); int mergeThreads = conf.getInt(MERGE_THREADS, MERGE_THREADS_DEFAULT); @@ -158,9 +155,8 @@ public class CompactSplitThread implements CompactionRequestor, PropagatingConfi mergeThreads, new ThreadFactory() { @Override public Thread newThread(Runnable r) { - Thread t = new Thread(r); - t.setName(n + "-merges-" + System.currentTimeMillis()); - return t; + String name = n + "-merges-" + System.currentTimeMillis(); + return new Thread(r, name); } }); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index f3eb27ff300..689daf11b1a 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -497,9 +497,6 @@ public class HRegionServer extends HasThread implements /** * Starts a HRegionServer at the default location. - * @param conf - * @throws IOException - * @throws InterruptedException */ public HRegionServer(Configuration conf) throws IOException, InterruptedException { this(conf, CoordinatedStateManagerFactory.getCoordinatedStateManager(conf)); @@ -507,13 +504,11 @@ public class HRegionServer extends HasThread implements /** * Starts a HRegionServer at the default location - * @param conf * @param csm implementation of CoordinatedStateManager to be used - * @throws IOException - * @throws InterruptedException */ public HRegionServer(Configuration conf, CoordinatedStateManager csm) throws IOException, InterruptedException { + super("RegionServer"); // thread name this.fsOk = true; this.conf = conf; checkCodecs(this.conf); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Leases.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Leases.java index 83b9fb12dea..eb8bd06504b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Leases.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Leases.java @@ -68,6 +68,7 @@ public class Leases extends HasThread { * (milliseconds) */ public Leases(final int leaseCheckFrequency) { + super("RegionServerLeases"); // thread name this.leaseCheckFrequency = leaseCheckFrequency; setDaemon(true); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java index 136e03ef591..ccc951a8595 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java @@ -94,7 +94,7 @@ public class LogRoller extends HasThread { /** @param server */ public LogRoller(final Server server, final RegionServerServices services) { - super(); + super("LogRoller"); this.server = server; this.services = services; this.rollperiod = this.server.getConfiguration(). diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ShutdownHook.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ShutdownHook.java index 83e4ea86be5..f19f26fe2f2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ShutdownHook.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ShutdownHook.java @@ -119,7 +119,8 @@ public class ShutdownHook { if (refs == 1) { LOG.info("Starting fs shutdown hook thread."); Thread fsShutdownHookThread = (fsShutdownHook instanceof Thread) ? - (Thread)fsShutdownHook : new Thread(fsShutdownHook); + (Thread)fsShutdownHook : new Thread(fsShutdownHook, + fsShutdownHook.getClass().getSimpleName() + "-shutdown-hook"); fsShutdownHookThread.start(); Threads.shutdown(fsShutdownHookThread, this.conf.getLong(FS_SHUTDOWN_HOOK_WAIT, 30000)); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java index 4e87c8ed9cd..4fa987508e3 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java @@ -718,7 +718,7 @@ public final class Canary implements Tool { // Do monitor !! try { monitor = this.newMonitor(connection, index, args); - monitorThread = new Thread(monitor); + monitorThread = new Thread(monitor, "CanaryMonitor-" + System.currentTimeMillis()); startTime = System.currentTimeMillis(); monitorThread.start(); while (!monitor.isDone()) { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JvmPauseMonitor.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JvmPauseMonitor.java index 436f04a9bc6..9288a45cca9 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JvmPauseMonitor.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JvmPauseMonitor.java @@ -83,9 +83,8 @@ public class JvmPauseMonitor { public void start() { Preconditions.checkState(monitorThread == null, "Already started"); - monitorThread = new Thread(new Monitor()); + monitorThread = new Thread(new Monitor(), "JvmPauseMonitor"); monitorThread.setDaemon(true); - monitorThread.setName("JvmPauseMonitor"); monitorThread.start(); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ModifyRegionUtils.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ModifyRegionUtils.java index 0aa98f1c87a..474e698741c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ModifyRegionUtils.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ModifyRegionUtils.java @@ -267,8 +267,7 @@ public abstract class ModifyRegionUtils { @Override public Thread newThread(Runnable r) { - Thread t = new Thread(r, threadNamePrefix + "-" + count++); - return t; + return new Thread(r, threadNamePrefix + "-" + count++); } }); return regionOpenAndInitThreadPool; diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluationCommons.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluationCommons.java index 3270c1c5aa1..3809a134fdf 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluationCommons.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluationCommons.java @@ -69,9 +69,7 @@ public class PerformanceEvaluationCommons { long now = System.currentTimeMillis(); List threads = new ArrayList(count); for (int i = 0; i < count; i++) { - Thread t = new Thread(r); - t.setName("" + i); - threads.add(t); + threads.add(new Thread(r, "concurrentRead-" + i)); } for (Thread t: threads) { t.start(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedAction.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedAction.java index 5b04ab98aec..2304732d34a 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedAction.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedAction.java @@ -162,7 +162,8 @@ public abstract class MultiThreadedAction { this.startKey = startKey; this.endKey = endKey; this.numThreads = numThreads; - (new Thread(new ProgressReporter(actionLetter))).start(); + (new Thread(new ProgressReporter(actionLetter), + "MultiThreadedAction-ProgressReporter-" + System.currentTimeMillis())).start(); } private static String formatTime(long elapsedTime) { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedWriterBase.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedWriterBase.java index d4e6d805d98..1bbd41076ec 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedWriterBase.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedWriterBase.java @@ -89,7 +89,8 @@ public abstract class MultiThreadedWriterBase extends MultiThreadedAction { wroteUpToKey.set(startKey - 1); if (trackWroteKeys) { - new Thread(new WroteKeysTracker()).start(); + new Thread(new WroteKeysTracker(), + "MultiThreadedWriterBase-WroteKeysTracker-" + System.currentTimeMillis()).start(); numThreadsWorking.incrementAndGet(); } }