aboutsummaryrefslogtreecommitdiffstats
path: root/sources/hv-collector-utils
diff options
context:
space:
mode:
authorPiotr Jaszczyk <piotr.jaszczyk@nokia.com>2019-04-05 08:45:26 +0200
committerPiotr Jaszczyk <piotr.jaszczyk@nokia.com>2019-04-09 08:44:25 +0200
commit415a3eed0d171ee33e2fd984d34c4e5950f8a931 (patch)
tree08e88d5fa8638414d68bb757f0b3d150f1b23957 /sources/hv-collector-utils
parente55809c0219be0898138c436d82ceba212b92df9 (diff)
Provide enhanced component description
Change-Id: Iaed53f9acc9cdc830b2069de6d96d5f2965d9466 Issue-ID: DCAEGEN2-1394 Signed-off-by: Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
Diffstat (limited to 'sources/hv-collector-utils')
-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)
}
}