From ab3b727b5f1511ea05f75d8798eaf85f6defcf53 Mon Sep 17 00:00:00 2001 From: Akira Ajisaka Date: Thu, 25 Aug 2016 13:54:57 +0900 Subject: [PATCH] HADOOP-13534. Remove unused TrashPolicy#getInstance and initialize code. Contributed by Yiqun Lin. --- .../org/apache/hadoop/fs/TrashPolicy.java | 30 ------------------- .../apache/hadoop/fs/TrashPolicyDefault.java | 15 ---------- .../java/org/apache/hadoop/fs/TestTrash.java | 4 --- 3 files changed, 49 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/TrashPolicy.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/TrashPolicy.java index 157b9ab5ee..bd99db403d 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/TrashPolicy.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/TrashPolicy.java @@ -36,17 +36,6 @@ public abstract class TrashPolicy extends Configured { protected Path trash; // path to trash directory protected long deletionInterval; // deletion interval for Emptier - /** - * Used to setup the trash policy. Must be implemented by all TrashPolicy - * implementations. - * @param conf the configuration to be used - * @param fs the filesystem to be used - * @param home the home directory - * @deprecated Use {@link #initialize(Configuration, FileSystem)} instead. - */ - @Deprecated - public abstract void initialize(Configuration conf, FileSystem fs, Path home); - /** * Used to setup the trash policy. Must be implemented by all TrashPolicy * implementations. Different from initialize(conf, fs, home), this one does @@ -110,25 +99,6 @@ public Path getCurrentTrashDir(Path path) throws IOException { */ public abstract Runnable getEmptier() throws IOException; - /** - * Get an instance of the configured TrashPolicy based on the value - * of the configuration parameter fs.trash.classname. - * - * @param conf the configuration to be used - * @param fs the file system to be used - * @param home the home directory - * @return an instance of TrashPolicy - * @deprecated Use {@link #getInstance(Configuration, FileSystem)} instead. - */ - @Deprecated - public static TrashPolicy getInstance(Configuration conf, FileSystem fs, Path home) { - Class trashClass = conf.getClass( - "fs.trash.classname", TrashPolicyDefault.class, TrashPolicy.class); - TrashPolicy trash = ReflectionUtils.newInstance(trashClass, conf); - trash.initialize(conf, fs, home); // initialize TrashPolicy - return trash; - } - /** * Get an instance of the configured TrashPolicy based on the value * of the configuration parameter fs.trash.classname. diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/TrashPolicyDefault.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/TrashPolicyDefault.java index 72222be04a..f4a825c451 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/TrashPolicyDefault.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/TrashPolicyDefault.java @@ -75,21 +75,6 @@ private TrashPolicyDefault(FileSystem fs, Configuration conf) initialize(conf, fs); } - /** - * @deprecated Use {@link #initialize(Configuration, FileSystem)} instead. - */ - @Override - @Deprecated - public void initialize(Configuration conf, FileSystem fs, Path home) { - this.fs = fs; - this.deletionInterval = (long)(conf.getFloat( - FS_TRASH_INTERVAL_KEY, FS_TRASH_INTERVAL_DEFAULT) - * MSECS_PER_MINUTE); - this.emptierInterval = (long)(conf.getFloat( - FS_TRASH_CHECKPOINT_INTERVAL_KEY, FS_TRASH_CHECKPOINT_INTERVAL_DEFAULT) - * MSECS_PER_MINUTE); - } - @Override public void initialize(Configuration conf, FileSystem fs) { this.fs = fs; diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java index 338aff6e8d..2aba01f897 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java @@ -691,10 +691,6 @@ public static void main(String [] arg) throws IOException{ public static class TestTrashPolicy extends TrashPolicy { public TestTrashPolicy() { } - @Override - public void initialize(Configuration conf, FileSystem fs, Path home) { - } - @Override public void initialize(Configuration conf, FileSystem fs) { }