diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/BaseFreonGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/BaseFreonGenerator.java index 20acad0562a..3627b917f00 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/BaseFreonGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/BaseFreonGenerator.java @@ -290,6 +290,10 @@ public void init() { //replace environment variables to support multi-node execution prefix = resolvePrefix(prefix); } + if (duration != null && !allowDuration()) { + LOG.warn("--duration is ignored"); + duration = null; + } if (duration != null) { durationInSecond = TimeDurationUtil.getTimeDurationHelper( "--runtime", duration, TimeUnit.SECONDS); @@ -554,6 +558,15 @@ public String getPrefix() { return prefix; } + /** + * Whether to enable Duration. + * If enabled, the command will load the --duration option. + * If not enabled, the command will not load the --duration option. + */ + public boolean allowDuration() { + return true; + } + public MetricRegistry getMetrics() { return metrics; } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketGenerator.java index a3e21d58e2f..27ebc877633 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketGenerator.java @@ -57,6 +57,11 @@ public class OmBucketGenerator extends BaseFreonGenerator private Timer bucketCreationTimer; + @Override + public boolean allowDuration() { + return false; + } + @Override public Void call() throws Exception {