From 415a3eed0d171ee33e2fd984d34c4e5950f8a931 Mon Sep 17 00:00:00 2001 From: Piotr Jaszczyk Date: Fri, 5 Apr 2019 08:45:26 +0200 Subject: Provide enhanced component description Change-Id: Iaed53f9acc9cdc830b2069de6d96d5f2965d9466 Issue-ID: DCAEGEN2-1394 Signed-off-by: Piotr Jaszczyk --- .../kotlin/org/onap/dcae/collectors/veshv/utils/server_handle.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sources/hv-collector-utils/src') 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 @@ -48,14 +49,16 @@ class NettyServerHandle(private val ctx: DisposableServer, .then(dispose()) private fun dispose(): Mono = - Mono.create { callback -> + Mono.create { 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 = 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) } } -- cgit 1.2.3-korg