Interface ClassLoaderService

    • Method Detail

      • registerDependencyServiceOfTenant

        void registerDependencyServiceOfTenant​(java.lang.Long tenantId,
                                               TenantDependencyService tenantDependencyService)
      • getClassLoader

        java.lang.ClassLoader getClassLoader​(ClassLoaderIdentifier identifier)
                                      throws SClassLoaderException
        Get the local ClassLoader for the given type and id. If no ClassLoader already exists, a new one is created and initialized. This initialization is executed in a different thread/transaction. It eagerly initialize parent classloaders.
        Parameters:
        identifier - of the classloader to refresh
        Returns:
        the local ClassLoader for the given type and id
        Throws:
        SClassLoaderException - Error thrown if it's impossible to get a local ClassLoader for the given type and id
      • addListener

        boolean addListener​(ClassLoaderIdentifier identifier,
                            SingleClassLoaderListener singleClassLoaderListener)
        add listener on a classloader
        Parameters:
        identifier - the classloader id
        singleClassLoaderListener - the listener to add
        Returns:
        true if the listener was added
      • removeListener

        boolean removeListener​(ClassLoaderIdentifier identifier,
                               SingleClassLoaderListener singleClassLoaderListener)
        Parameters:
        identifier - the classloader id
        singleClassLoaderListener - classloader listener to remove
        Returns:
        true if the listener was removed
      • refreshClassLoaderImmediatelyWithRollback

        void refreshClassLoaderImmediatelyWithRollback​(ClassLoaderIdentifier identifier)
                                                throws SClassLoaderException
        This method refreshes in the current thread/transaction the classLoader with the given identifier. Contrary to refreshClassLoaderImmediately, it creates a synchronization that triggers a reload of the classloader in case the transaction was rolled back, insuring there is no new loaded class in the classloader after the rollback.

        e.g. If the classloader was set as the current context classloader, it should be reset like this

          
         Thread.currentThread().setContextClassLoader(classLoaderService.getLocalClassLoader(identifier));
         
         
        Parameters:
        identifier - of the classloader to refresh
        Throws:
        SClassLoaderException
      • refreshClassLoaderImmediately

        void refreshClassLoaderImmediately​(ClassLoaderIdentifier identifier)
                                    throws SClassLoaderException
        This method refreshes in the current thread/transaction the classLoader with the given identifier. It eagerly initializes parents classloaders.

        A new classloader will be created. In order to use the new classloader, references to the old one should be updated.

        e.g. If the classloader was set as the current context classloader, it should be reset like this

          
         Thread.currentThread().setContextClassLoader(classLoaderService.getLocalClassLoader(identifier));
         
         
        Parameters:
        identifier - of the classloader to refresh
        Throws:
        SClassLoaderException
      • removeRefreshClassLoaderSynchronization

        void removeRefreshClassLoaderSynchronization()