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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanaddListener(ClassLoaderIdentifier identifier, SingleClassLoaderListener singleClassLoaderListener)add listener on a classloaderjava.lang.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.voidrefreshClassLoaderImmediatelyWithRollback(ClassLoaderIdentifier identifier)This method refreshes in the current thread/transaction the classLoader with the given identifier.voidrefreshClassLoaderOnOtherNodes(ClassLoaderIdentifier identifier)voidregisterDependencyServiceOfTenant(java.lang.Long tenantId, TenantDependencyService tenantDependencyService)booleanremoveListener(ClassLoaderIdentifier identifier, SingleClassLoaderListener singleClassLoaderListener)voidremoveLocalClassloader(ClassLoaderIdentifier identifier)voidremoveRefreshClassLoaderSynchronization()-
Methods inherited from interface org.bonitasoft.engine.commons.LifecycleService
pause, resume, start, stop
-
-
-
-
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
-
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 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
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()
-
-