Class Loader


  • class Loader
    extends java.lang.Object
    The Loader object is used to provide class loading for the strategies. This will attempt to load the class using the thread context class loader, if this loader is set it will be used to load the class. If not then the class will be loaded using the caller class loader. Loading in this way ensures that a custom loader can be provided using the current thread.
    • Constructor Summary

      Constructors 
      Constructor Description
      Loader()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.lang.ClassLoader getCallerClassLoader()
      This is used to acquire the caller class loader for this object.
      private static java.lang.ClassLoader getClassLoader()
      This is used to acquire the thread context class loader.
      java.lang.Class load​(java.lang.String type)
      This method is used to acquire the class of the specified name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Loader

        Loader()
    • Method Detail

      • load

        public java.lang.Class load​(java.lang.String type)
                             throws java.lang.Exception
        This method is used to acquire the class of the specified name. Loading is performed by the thread context class loader as this will ensure that the class loading strategy can be changed as requirements dictate. Typically the thread context class loader can handle all serialization requirements.
        Parameters:
        type - this is the name of the class that is to be loaded
        Returns:
        this returns the class that has been loaded by this
        Throws:
        java.lang.Exception
      • getCallerClassLoader

        private static java.lang.ClassLoader getCallerClassLoader()
                                                           throws java.lang.Exception
        This is used to acquire the caller class loader for this object. Typically this is only used if the thread context class loader is set to null. This ensures that there is at least some class loader available to the strategy to load the class.
        Returns:
        this returns the loader that loaded this class
        Throws:
        java.lang.Exception
      • getClassLoader

        private static java.lang.ClassLoader getClassLoader()
                                                     throws java.lang.Exception
        This is used to acquire the thread context class loader. This is the default class loader used by the cycle strategy. When using the thread context class loader the caller can switch the class loader in use, which allows class loading customization.
        Returns:
        this returns the loader used by the calling thread
        Throws:
        java.lang.Exception