ENT-11620: Set the thread context class loader so all fibres involved in a flow has the thread context class loader set to the app class loader.

This commit is contained in:
Adel El-Beik 2024-03-13 11:01:41 +00:00
parent 4faa0caeb3
commit 99faeaf667

View File

@ -320,6 +320,9 @@ class FlowStateMachineImpl<R>(override val id: StateMachineRunId,
}
private fun openThreadLocalWormhole() {
// This sets the Cordapp classloader on the contextClassLoader of the current thread.
// Needed because in previous versions of the finance app we used Thread.contextClassLoader to resolve services defined in cordapps.
Thread.currentThread().contextClassLoader = (serviceHub.cordappProvider as CordappProviderImpl).cordappLoader.appClassLoader
val threadLocal = transientValues.database.hikariPoolThreadLocal
if (threadLocal != null) {
val valueFromThread = swappedOutThreadLocalValue(threadLocal)