[Gradle] Remove redundant thread-safety in BuildStatisticsWithKtorIT

This commit is contained in:
Alexander.Likhachev
2023-01-11 02:53:23 +01:00
committed by Space Team
parent 25004a4842
commit 32b98135a9
@@ -37,12 +37,9 @@ import kotlin.test.*
class BuildStatisticsWithKtorIT : KGPBaseTest() {
companion object {
private val portSelectLock = java.util.concurrent.locks.ReentrantLock()
fun runWithKtorService(action: (Int) -> Unit) {
var server: ApplicationEngine? = null
try {
portSelectLock.lock()
val port = getEmptyPort().localPort
server = embeddedServer(Netty, host = "localhost", port = port)
{
@@ -71,12 +68,8 @@ class BuildStatisticsWithKtorIT : KGPBaseTest() {
}
}.start()
awaitInitialization(port)
portSelectLock.unlock()
action(port)
} finally {
if (portSelectLock.isLocked) {
portSelectLock.unlock()
}
server?.stop(1000, 1000)
}
}