Mocknetwork remove hibernate sessions on stop

This commit is contained in:
chriscochrane 2024-10-25 15:25:59 +01:00
parent d27aa0e685
commit eece1e923c
No known key found for this signature in database
GPG Key ID: E20C3731120606AB
2 changed files with 3 additions and 0 deletions

View File

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

View File

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