From 72ffc6b3bd662282cf3d6a020d384a9a9105351d Mon Sep 17 00:00:00 2001 From: Adam Fraser Date: Tue, 22 Mar 2022 22:04:25 -0700 Subject: [PATCH] rename --- zio-http/src/main/scala/zhttp/service/ChannelFuture.scala | 4 ++-- zio-http/src/main/scala/zhttp/service/Server.scala | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zio-http/src/main/scala/zhttp/service/ChannelFuture.scala b/zio-http/src/main/scala/zhttp/service/ChannelFuture.scala index 63531eb2d0..815783d452 100644 --- a/zio-http/src/main/scala/zhttp/service/ChannelFuture.scala +++ b/zio-http/src/main/scala/zhttp/service/ChannelFuture.scala @@ -29,7 +29,7 @@ final class ChannelFuture[A] private (jFuture: Future[A]) { .onInterrupt(ZIO.succeed(jFuture.removeListener(handler))) } - def scoped: ZIO[Scope, Throwable, Option[A]] = { + def toZIO: ZIO[Scope, Throwable, Option[A]] = { execute.withFinalizer(cancel(true)) } @@ -42,5 +42,5 @@ object ChannelFuture { def unit[A](jFuture: => Future[A]): Task[Unit] = make(jFuture).flatMap(_.execute.unit) - def scoped[A](jFuture: => Future[A]): ZIO[Scope, Throwable, Unit] = make(jFuture).flatMap(_.scoped.unit) + def asZIO[A](jFuture: => Future[A]): ZIO[Scope, Throwable, Unit] = make(jFuture).flatMap(_.toZIO.unit) } diff --git a/zio-http/src/main/scala/zhttp/service/Server.scala b/zio-http/src/main/scala/zhttp/service/Server.scala index f46a2e9ff4..df2feac05a 100644 --- a/zio-http/src/main/scala/zhttp/service/Server.scala +++ b/zio-http/src/main/scala/zhttp/service/Server.scala @@ -230,7 +230,7 @@ object Server { init = ServerChannelInitializer(zExec, settings, reqHandler) serverBootstrap = new ServerBootstrap().channelFactory(channelFactory).group(eventLoopGroup) chf <- ZIO.attempt(serverBootstrap.childHandler(init).bind(settings.address)) - _ <- ChannelFuture.scoped(chf) + _ <- ChannelFuture.asZIO(chf) port <- ZIO.attempt(chf.channel().localAddress().asInstanceOf[InetSocketAddress].getPort) } yield { ResourceLeakDetector.setLevel(settings.leakDetectionLevel.jResourceLeakDetectionLevel)