HDFS-1730. Use DaemonFactory from common and delete it from HDFS. Contributed by Tanping.



git-svn-id: https://svn.apache.org/repos/asf/hadoop/hdfs/trunk@1104463 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES.txt b/CHANGES.txt
index 83cc4d6..7441e28 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -424,6 +424,9 @@
     HDFS-1945. Removed the deprecated fields in DataTransferProtocol.
     (szetszwo)
 
+    HDFS-1730. Use DaemonFactory from common and delete it from HDFS.
+    (Tanping via suresh)
+
   OPTIMIZATIONS
 
     HDFS-1458. Improve checkpoint performance by avoiding unnecessary image
diff --git a/src/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java b/src/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java
index 948b6f3..6fec7c9 100644
--- a/src/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java
+++ b/src/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java
@@ -42,7 +42,7 @@
 import org.apache.hadoop.hdfs.protocol.Block;
 import org.apache.hadoop.hdfs.server.common.GenerationStamp;
 import org.apache.hadoop.hdfs.server.datanode.FSDataset.FSVolume;
-import org.apache.hadoop.hdfs.util.DaemonFactory;
+import org.apache.hadoop.util.Daemon;
 
 /**
  * Periodically scans the data directories for block and block metadata files.
@@ -228,8 +228,9 @@
                     DFSConfigKeys.DFS_DATANODE_DIRECTORYSCAN_THREADS_DEFAULT);
 
     reportCompileThreadPool = Executors.newFixedThreadPool(threads, 
-        new DaemonFactory());
-    masterThread = new ScheduledThreadPoolExecutor(1, new DaemonFactory());
+        new Daemon.DaemonFactory());
+    masterThread = new ScheduledThreadPoolExecutor(1,
+        new Daemon.DaemonFactory());
   }
 
   void start() {
diff --git a/src/java/org/apache/hadoop/hdfs/util/DaemonFactory.java b/src/java/org/apache/hadoop/hdfs/util/DaemonFactory.java
deleted file mode 100644
index 536c7ff..0000000
--- a/src/java/org/apache/hadoop/hdfs/util/DaemonFactory.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hdfs.util;
-
-import java.util.concurrent.ThreadFactory;
-
-import org.apache.hadoop.classification.InterfaceAudience;
-import org.apache.hadoop.classification.InterfaceStability;
-import org.apache.hadoop.util.Daemon;
-
-/**
- * Provide a factory for named daemon threads,
- * for use in ExecutorServices constructors
- * 
- * TODO:FEDERATION This should become an inner class of the 
- * org.apache.hadoop.util.Daemon class
- * after Federation is united with trunk.
- */
-@InterfaceAudience.Private
-@InterfaceStability.Unstable
-public class DaemonFactory extends Daemon implements ThreadFactory {
-
-  public Thread newThread(Runnable runnable) {
-    return new Daemon(runnable);
-  }
-
-}