Class ThreadContextClassLoaderBuilder.DefaultHolder

    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultHolder​(java.lang.Thread affectedThread, java.lang.ClassLoader originalClassLoader, java.lang.String classPathArgument)
      Compound constructor creating a default-implementation ThreadContextClassLoaderHolder which wraps references to the Thread affected as well as the original ClassLoader to restore during the call to restoreClassLoaderAndReleaseThread() method.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void finalize()
      java.lang.String getClassPathAsArgument()
      Retrieves the ClassPath held by this ThreadContextClassLoaderHolder as a File.pathSeparatorChar-separated string.
      void restoreClassLoaderAndReleaseThread()
      Restores the original ThreadContext ClassLoader, and nullifies any references to the Thread which had its ThreadContext ClassLoader altered.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • affectedThread

        private java.lang.Thread affectedThread
      • originalClassLoader

        private java.lang.ClassLoader originalClassLoader
      • classPathArgument

        private java.lang.String classPathArgument
    • Constructor Detail

      • DefaultHolder

        public DefaultHolder​(java.lang.Thread affectedThread,
                             java.lang.ClassLoader originalClassLoader,
                             java.lang.String classPathArgument)
        Compound constructor creating a default-implementation ThreadContextClassLoaderHolder which wraps references to the Thread affected as well as the original ClassLoader to restore during the call to restoreClassLoaderAndReleaseThread() 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 to getClassPathAsArgument().
    • Method Detail

      • 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 interface ThreadContextClassLoaderHolder
      • getClassPathAsArgument

        public java.lang.String getClassPathAsArgument()
        Retrieves the ClassPath held by this ThreadContextClassLoaderHolder as a File.pathSeparatorChar-separated string. This is directly usable as a String argument by any external process.
        Specified by:
        getClassPathAsArgument in interface ThreadContextClassLoaderHolder
        Returns:
        the ClassPath as an argument to external processes such as XJC.
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable