From c775e8677cdbf69f2b1c1390d225329c658c0ee2 Mon Sep 17 00:00:00 2001 From: Piotr Jaszczyk Date: Wed, 3 Apr 2019 15:07:22 +0200 Subject: Get rid of arrow-effects usage Also clean-up dependencies + use Kotlin BOM to force single kotlin-stdlib on classpath. Issue-ID: DCAEGEN2-1392 Change-Id: I447c4686707de81f35f7734255ce0b13c997c4a4 Signed-off-by: Piotr Jaszczyk --- sources/hv-collector-health-check/pom.xml | 5 ----- .../collectors/veshv/healthcheck/factory/HealthCheckApiServer.kt | 9 +++++---- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'sources/hv-collector-health-check') diff --git a/sources/hv-collector-health-check/pom.xml b/sources/hv-collector-health-check/pom.xml index 68915939..90ec958d 100644 --- a/sources/hv-collector-health-check/pom.xml +++ b/sources/hv-collector-health-check/pom.xml @@ -48,16 +48,11 @@ io.projectreactor.netty reactor-netty - - io.arrow-kt - arrow-effects - ch.qos.logback logback-classic test - org.jetbrains.kotlin kotlin-test diff --git a/sources/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/factory/HealthCheckApiServer.kt b/sources/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/factory/HealthCheckApiServer.kt index fb5bb9a2..cff8160c 100644 --- a/sources/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/factory/HealthCheckApiServer.kt +++ b/sources/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/factory/HealthCheckApiServer.kt @@ -19,7 +19,6 @@ */ package org.onap.dcae.collectors.veshv.healthcheck.factory -import arrow.effects.IO import io.netty.handler.codec.http.HttpResponseStatus import org.onap.dcae.collectors.veshv.healthcheck.api.HealthDescription import org.onap.dcae.collectors.veshv.healthcheck.api.HealthState @@ -45,9 +44,9 @@ class HealthCheckApiServer(private val healthState: HealthState, private val healthDescription: AtomicReference = AtomicReference(HealthDescription.STARTING) - fun start(): IO = IO { + fun start(): Mono = Mono.defer { healthState().subscribe(healthDescription::set) - val ctx = HttpServer.create() + HttpServer.create() .tcpConfiguration { it.addressSupplier { listenAddress } .doOnUnbound { logClose() } @@ -57,7 +56,9 @@ class HealthCheckApiServer(private val healthState: HealthState, routes.get("/health/alive", ::livenessHandler) routes.get("/monitoring/prometheus", ::monitoringHandler) } - NettyServerHandle(ctx.bindNow()) + .bind() + .map { NettyServerHandle(it) } + } private fun readinessHandler(_req: HttpServerRequest, resp: HttpServerResponse) = -- cgit 1.2.3-korg