diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java index 4de53f94feb..1ce565362b6 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -276,7 +276,7 @@ public class Restarter { Assert.notNull(this.mainClassName, "Unable to find the main class to restart"); URL[] urls = this.urls.toArray(new URL[0]); ClassLoaderFiles updatedFiles = new ClassLoaderFiles(this.classLoaderFiles); - ClassLoader classLoader = new RestartClassLoader(this.applicationClassLoader, urls, updatedFiles, this.logger); + ClassLoader classLoader = new RestartClassLoader(this.applicationClassLoader, urls, updatedFiles); if (this.logger.isDebugEnabled()) { this.logger.debug("Starting application " + this.mainClassName + " with URLs " + Arrays.asList(urls)); } diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoader.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoader.java index 1021b20ceec..221578e1648 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoader.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoader.java @@ -42,8 +42,6 @@ import org.springframework.util.Assert; */ public class RestartClassLoader extends URLClassLoader implements SmartClassLoader { - private final Log logger; - private final ClassLoaderFileRepository updatedFiles; /** @@ -73,14 +71,16 @@ public class RestartClassLoader extends URLClassLoader implements SmartClassLoad * URLs were created. * @param urls the urls managed by the classloader * @param logger the logger used for messages + * @deprecated since 2.4.11 for removal in 2.7.0 in favor of + * {@link #RestartClassLoader(ClassLoader, URL[], ClassLoaderFileRepository)} */ + @Deprecated public RestartClassLoader(ClassLoader parent, URL[] urls, ClassLoaderFileRepository updatedFiles, Log logger) { super(urls, parent); Assert.notNull(parent, "Parent must not be null"); Assert.notNull(updatedFiles, "UpdatedFiles must not be null"); Assert.notNull(logger, "Logger must not be null"); this.updatedFiles = updatedFiles; - this.logger = logger; if (logger.isDebugEnabled()) { logger.debug("Created RestartClassLoader " + toString()); } @@ -187,14 +187,6 @@ public class RestartClassLoader extends URLClassLoader implements SmartClassLoad } } - @Override - protected void finalize() throws Throwable { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Finalized classloader " + toString()); - } - super.finalize(); - } - @Override public boolean isClassReloadable(Class classType) { return (classType.getClassLoader() instanceof RestartClassLoader); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/socket/FileDescriptor.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/socket/FileDescriptor.java index 69c02b4fc98..c2ab74e0a8b 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/socket/FileDescriptor.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/socket/FileDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,11 +44,6 @@ class FileDescriptor { this.closer = closer; } - @Override - protected void finalize() throws Throwable { - close(); - } - /** * Acquire an instance of the actual {@link Handle}. The caller must * {@link Handle#close() close} the resulting handle when done.