Class ThreadContextClassLoaderBuilder.DefaultHolder
java.lang.Object
org.codehaus.mojo.jaxb2.shared.environment.classloading.ThreadContextClassLoaderBuilder.DefaultHolder
- All Implemented Interfaces:
ThreadContextClassLoaderHolder
- Enclosing class:
ThreadContextClassLoaderBuilder
class ThreadContextClassLoaderBuilder.DefaultHolder
extends Object
implements ThreadContextClassLoaderHolder
Default implementation of the ThreadContextClassLoaderCleaner specification,
with added finalizer to ensure we release the Thread reference no matter
what happens with any DefaultCleaner objects.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultHolder
(Thread affectedThread, ClassLoader originalClassLoader, String classPathArgument) Compound constructor creating a default-implementationThreadContextClassLoaderHolder
which wraps references to theThread
affected as well as the original ClassLoader to restore during the call torestoreClassLoaderAndReleaseThread()
method. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
finalize()
Retrieves the ClassPath held by this ThreadContextClassLoaderHolder as aFile.pathSeparatorChar
-separated string.void
Restores the original ThreadContext ClassLoader, and nullifies any references to the Thread which had its ThreadContext ClassLoader altered.
-
Field Details
-
affectedThread
-
originalClassLoader
-
classPathArgument
-
-
Constructor Details
-
DefaultHolder
public DefaultHolder(Thread affectedThread, ClassLoader originalClassLoader, String classPathArgument) Compound constructor creating a default-implementationThreadContextClassLoaderHolder
which wraps references to theThread
affected as well as the original ClassLoader to restore during the call torestoreClassLoaderAndReleaseThread()
method.- Parameters:
affectedThread
- The non-null Thread for which a new ClassLoader should be constructed.originalClassLoader
- The non-null original ClassLoader.classPathArgument
- The non-null classpath argument, to be returned from the method call togetClassPathAsArgument()
.
-
-
Method Details
-
restoreClassLoaderAndReleaseThread
public void restoreClassLoaderAndReleaseThread()Restores the original ThreadContext ClassLoader, and nullifies any references to the Thread which had its ThreadContext ClassLoader altered.- Specified by:
restoreClassLoaderAndReleaseThread
in interfaceThreadContextClassLoaderHolder
-
getClassPathAsArgument
Retrieves the ClassPath held by this ThreadContextClassLoaderHolder as aFile.pathSeparatorChar
-separated string. This is directly usable as a String argument by any external process.- Specified by:
getClassPathAsArgument
in interfaceThreadContextClassLoaderHolder
- Returns:
- the ClassPath as an argument to external processes such as XJC.
-
finalize
-