aboutsummaryrefslogtreecommitdiffstats
path: root/sources/hv-collector-utils/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'sources/hv-collector-utils/src/main/kotlin')
-rw-r--r--sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/server_handle.kt8
1 files changed, 6 insertions, 2 deletions
diff --git a/sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/server_handle.kt b/sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/server_handle.kt
index 728d62bb..9c0a6e1c 100644
--- a/sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/server_handle.kt
+++ b/sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/server_handle.kt
@@ -22,6 +22,7 @@ package org.onap.dcae.collectors.veshv.utils
import org.onap.dcae.collectors.veshv.utils.logging.Logger
import reactor.core.publisher.Mono
import reactor.netty.DisposableServer
+import java.time.Duration
/**
* @author Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
@@ -48,14 +49,16 @@ class NettyServerHandle(private val ctx: DisposableServer,
.then(dispose())
private fun dispose(): Mono<Void> =
- Mono.create { callback ->
+ Mono.create<Int> { callback ->
logger.debug { "About to dispose NettyServer" }
ctx.dispose()
ctx.onDispose {
logger.debug { "Netty server disposed" }
- callback.success()
+ callback.success(1)
}
}
+ .delayElement(boundPortReleaseLatency)
+ .then()
override fun await(): Mono<Void> = Mono.create { callback ->
ctx.channel().closeFuture().addListener {
@@ -65,5 +68,6 @@ class NettyServerHandle(private val ctx: DisposableServer,
companion object {
private val logger = Logger(NettyServerHandle::class)
+ private val boundPortReleaseLatency = Duration.ofSeconds(1)
}
}