Merge pull request #7856 from corda/cc/dev/os/4.12/ent-12154/mocknetwork_leak

ENT-12154 - Remove Hibernate sessions when done with them
This commit is contained in:
Adel El-Beik 2024-10-28 13:40:13 +00:00 committed by GitHub
commit 7852754ad9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 0 deletions

View File

@ -101,6 +101,7 @@ dependencies {
}
implementation "co.paralleluniverse:quasar-core:$quasar_version"
implementation "org.hibernate:hibernate-core:$hibernate_version"
}
compileJava {

View File

@ -83,6 +83,7 @@ import java.time.Clock
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicInteger
import java.util.concurrent.atomic.AtomicReference
import org.hibernate.internal.SessionFactoryRegistry
import kotlin.io.path.createDirectories
import kotlin.io.path.deleteIfExists
import kotlin.io.path.div
@ -620,6 +621,7 @@ open class InternalMockNetwork(cordappPackages: List<String> = emptyList(),
}
messagingNetwork.stop()
}
SessionFactoryRegistry.INSTANCE.clearRegistrations()
}
/** Block until all scheduled activity, active flows and network activity has ceased. */