Package org.eclipse.jetty.util.thread
Class PrivilegedThreadFactory
java.lang.Object
org.eclipse.jetty.util.thread.PrivilegedThreadFactory
Convenience class to ensure that a new Thread is created
inside a privileged block.
This prevents the Thread constructor
from pinning the caller's context classloader. This happens
when the Thread constructor takes a snapshot of the current
calling context - which contains ProtectionDomains that may
reference the context classloader - and remembers it for the
lifetime of the Thread.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
PrivilegedThreadFactory
PrivilegedThreadFactory()
-
-
Method Details
-
newThread
Use a Supplier to make a new thread, calling it within a privileged block to prevent classloader pinning.- Parameters:
newThreadSupplier
- a Supplier to create a fresh thread- Returns:
- a new thread, protected from classloader pinning.
-