< prev index next >
src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java
Print this page
8190324: ThreadPoolExecutor should not specify a dependency on finalization
Reviewed-by: martin, psandoz, alanb, rriggs, dholmes
*** 33,45 ****
* http://creativecommons.org/publicdomain/zero/1.0/
*/
package java.util.concurrent;
- import java.security.AccessControlContext;
- import java.security.AccessController;
- import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.ConcurrentModificationException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
--- 33,42 ----
*** 266,277 ****
*
* <dt>Reclamation</dt>
*
* <dd>A pool that is no longer referenced in a program <em>AND</em>
* has no remaining threads may be reclaimed (garbage collected)
! * without being explicity shutdown. You can configure a pool to allow
! * all unused threads to eventually die by setting appropriate
* keep-alive times, using a lower bound of zero core threads and/or
* setting {@link #allowCoreThreadTimeOut(boolean)}. </dd>
*
* </dl>
*
--- 263,274 ----
*
* <dt>Reclamation</dt>
*
* <dd>A pool that is no longer referenced in a program <em>AND</em>
* has no remaining threads may be reclaimed (garbage collected)
! * without being explicitly shutdown. You can configure a pool to
! * allow all unused threads to eventually die by setting appropriate
* keep-alive times, using a lower bound of zero core threads and/or
* setting {@link #allowCoreThreadTimeOut(boolean)}. </dd>
*
* </dl>
*
*** 1460,1469 ****
--- 1457,1478 ----
} finally {
mainLock.unlock();
}
}
+ // Override without "throws Throwable" for compatibility with subclasses
+ // whose finalize method invokes super.finalize() (as is recommended).
+ // Before JDK 11, finalize() had a non-empty method body.
+
+ /**
+ * @implNote Previous versions of this class had a finalize method
+ * that shut down this executor, but in this version, finalize
+ * does nothing.
+ */
+ @Deprecated(since="9")
+ protected void finalize() {}
+
/**
* Sets the thread factory used to create new threads.
*
* @param threadFactory the new thread factory
* @throws NullPointerException if threadFactory is null
< prev index next >