Interface ClassLoaderService

All Superinterfaces:
LifecycleService, PlatformLifecycleService
All Known Implementing Classes:
ClassLoaderServiceImpl

public interface ClassLoaderService extends PlatformLifecycleService
Since:
6.0
Author:
Elias Ricken de Medeiros, Celine Souchet
  • Method Details

    • registerDependencyService

      void registerDependencyService(TenantDependencyService tenantDependencyService)
    • getClassLoader

      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
    • removeLocalClassloader

      void removeLocalClassloader(ClassLoaderIdentifier identifier) throws SClassLoaderException
      Throws:
      SClassLoaderException
    • 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
    • refreshClassLoaderAfterUpdate

      void refreshClassLoaderAfterUpdate(ClassLoaderIdentifier identifier) throws SClassLoaderException
      Throws:
      SClassLoaderException
    • refreshClassLoaderOnOtherNodes

      void refreshClassLoaderOnOtherNodes(ClassLoaderIdentifier identifier) throws SClassLoaderException
      Throws:
      SClassLoaderException
    • 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()