From a1ab4333e0a1a28ac2e0f9c75871f7feeb5f2f81 Mon Sep 17 00:00:00 2001 From: Sebastian Nagel Date: Sat, 30 Sep 2023 11:12:07 +0200 Subject: [PATCH] NUTCH-2897 Do not supress deprecated API warnings - deprecate constructor of NutchJob - remove deprocated call to Object.finalize() from Plugin.finalize() --- src/java/org/apache/nutch/plugin/Plugin.java | 2 -- src/java/org/apache/nutch/util/NutchJob.java | 13 ++++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/java/org/apache/nutch/plugin/Plugin.java b/src/java/org/apache/nutch/plugin/Plugin.java index b2e717d20e..3a0fb2e915 100644 --- a/src/java/org/apache/nutch/plugin/Plugin.java +++ b/src/java/org/apache/nutch/plugin/Plugin.java @@ -90,9 +90,7 @@ private void setDescriptor(PluginDescriptor descriptor) { } @Override - @SuppressWarnings("deprecation") protected void finalize() throws Throwable { - super.finalize(); shutDown(); } } diff --git a/src/java/org/apache/nutch/util/NutchJob.java b/src/java/org/apache/nutch/util/NutchJob.java index 478b24f89e..068c64fefb 100644 --- a/src/java/org/apache/nutch/util/NutchJob.java +++ b/src/java/org/apache/nutch/util/NutchJob.java @@ -35,7 +35,18 @@ public class NutchJob extends Job { private static final String JOB_FAILURE_LOG_FORMAT = "%s job did not succeed, job id: %s, job status: %s, reason: %s"; - @SuppressWarnings("deprecation") + /** + * @deprecated, use instead {@link #getInstance(Configuration)} or + * {@link Job#getInstance(Configuration, String)}. + * + * @param conf + * configuration for the job + * @param jobName + * name of the job + * @throws IOException + * see {@link Job#Job(Configuration, String)} + */ + @Deprecated public NutchJob(Configuration conf, String jobName) throws IOException { super(conf, jobName); if (conf != null) {