All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.allegro.tech.servicemesh.envoycontrol.config.service.EchoServiceExtension.kt Maven / Gradle / Ivy

There is a newer version: 0.22.4
Show newest version
package pl.allegro.tech.servicemesh.envoycontrol.config.service

import org.junit.jupiter.api.extension.ExtensionContext
import pl.allegro.tech.servicemesh.envoycontrol.config.sharing.ContainerPool

class EchoServiceExtension : ServiceExtension {

    companion object {
        private val pool = ContainerPool { EchoContainer() }
    }

    var started = false
    private var container: EchoContainer? = null

    override fun container() = container!!

    override fun beforeAll(context: ExtensionContext) {
        if (started) {
            return
        }

        container = pool.acquire(this)
        started = true
    }

    override fun afterAll(context: ExtensionContext) {
        pool.release(this)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy