Interface ClassLoaderService
- All Superinterfaces:
LifecycleService,PlatformLifecycleService
- All Known Implementing Classes:
ClassLoaderServiceImpl
- Since:
- 6.0
- Author:
- Elias Ricken de Medeiros, Celine Souchet
-
Method Summary
Modifier and TypeMethodDescriptionbooleanaddListener(ClassLoaderIdentifier identifier, SingleClassLoaderListener singleClassLoaderListener) add listener on a classloadergetClassLoader(ClassLoaderIdentifier identifier) Get the local ClassLoader for the given type and id.voidrefreshClassLoaderAfterUpdate(ClassLoaderIdentifier identifier) voidrefreshClassLoaderImmediately(ClassLoaderIdentifier identifier) This method refreshes in the current thread/transaction the classLoader with the given identifier.voidThis method refreshes in the current thread/transaction the classLoader with the given identifier.voidrefreshClassLoaderOnOtherNodes(ClassLoaderIdentifier identifier) voidregisterDependencyService(TenantDependencyService tenantDependencyService) booleanremoveListener(ClassLoaderIdentifier identifier, SingleClassLoaderListener singleClassLoaderListener) voidremoveLocalClassloader(ClassLoaderIdentifier identifier) voidMethods inherited from interface org.bonitasoft.engine.commons.LifecycleService
pause, resume, start, stop
-
Method Details
-
registerDependencyService
-
getClassLoader
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
- Throws:
SClassLoaderException
-
addListener
boolean addListener(ClassLoaderIdentifier identifier, SingleClassLoaderListener singleClassLoaderListener) add listener on a classloader- Parameters:
identifier- the classloader idsingleClassLoaderListener- the listener to add- Returns:
- true if the listener was added
-
removeListener
boolean removeListener(ClassLoaderIdentifier identifier, SingleClassLoaderListener singleClassLoaderListener) - Parameters:
identifier- the classloader idsingleClassLoaderListener- classloader listener to remove- Returns:
- true if the listener was removed
-
refreshClassLoaderAfterUpdate
- Throws:
SClassLoaderException
-
refreshClassLoaderOnOtherNodes
- 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
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()
-