diff --git a/akka-http-core/src/main/scala/akka/http/javadsl/ServerBinding.scala b/akka-http-core/src/main/scala/akka/http/javadsl/ServerBinding.scala index a3bcbed642..9cfe0537a4 100644 --- a/akka-http-core/src/main/scala/akka/http/javadsl/ServerBinding.scala +++ b/akka-http-core/src/main/scala/akka/http/javadsl/ServerBinding.scala @@ -11,10 +11,10 @@ import akka.actor.ClassicActorSystemProvider import akka.annotation.DoNotInherit import akka.dispatch.ExecutionContexts import akka.Done -import akka.util.JavaDurationConverters._ import scala.concurrent.duration.FiniteDuration import scala.jdk.FutureConverters._ +import scala.jdk.DurationConverters._ /** * Represents a prospective HTTP server binding. @@ -92,7 +92,7 @@ class ServerBinding private[http] (delegate: akka.http.scaladsl.Http.ServerBindi */ def whenTerminationSignalIssued: CompletionStage[java.time.Duration] = delegate.whenTerminationSignalIssued - .map(deadline => deadline.time.asJava)(ExecutionContexts.parasitic) + .map(deadline => deadline.time.toJava)(ExecutionContexts.parasitic) .asJava /** @@ -119,8 +119,7 @@ class ServerBinding private[http] (delegate: akka.http.scaladsl.Http.ServerBindi * @param hardTerminationDeadline timeout after which all requests and connections shall be forcefully terminated */ def addToCoordinatedShutdown(hardTerminationDeadline: java.time.Duration, system: ClassicActorSystemProvider): ServerBinding = { - import akka.util.JavaDurationConverters._ - delegate.addToCoordinatedShutdown(hardTerminationDeadline.asScala)(system) + delegate.addToCoordinatedShutdown(hardTerminationDeadline.toScala)(system) this } } diff --git a/akka-http-core/src/main/scala/akka/http/javadsl/settings/ConnectionPoolSettings.scala b/akka-http-core/src/main/scala/akka/http/javadsl/settings/ConnectionPoolSettings.scala index 8781c9e721..e3b3c1f595 100644 --- a/akka-http-core/src/main/scala/akka/http/javadsl/settings/ConnectionPoolSettings.scala +++ b/akka-http-core/src/main/scala/akka/http/javadsl/settings/ConnectionPoolSettings.scala @@ -15,7 +15,6 @@ import akka.annotation.{ ApiMayChange, DoNotInherit } import akka.http.impl.settings.ConnectionPoolSettingsImpl import akka.http.impl.util.JavaMapping.Implicits._ import akka.http.javadsl.ClientTransport -import akka.util.JavaDurationConverters._ /** * Public API but not intended for subclassing @@ -27,7 +26,9 @@ abstract class ConnectionPoolSettings private[akka] () { self: ConnectionPoolSet def getMaxRetries: Int = maxRetries def getMaxOpenRequests: Int = maxOpenRequests def getPipeliningLimit: Int = pipeliningLimit - def getMaxConnectionLifetime: JDuration = maxConnectionLifetime.asJava + def getMaxConnectionLifetime: JDuration = + if (maxConnectionLifetime.isFinite) JDuration.ofNanos(maxConnectionLifetime.toNanos) + else JDuration.ZERO def getBaseConnectionBackoff: FiniteDuration = baseConnectionBackoff def getMaxConnectionBackoff: FiniteDuration = maxConnectionBackoff def getIdleTimeout: Duration = idleTimeout diff --git a/akka-http/src/main/scala/akka/http/javadsl/common/SSLContextFactory.scala b/akka-http/src/main/scala/akka/http/javadsl/common/SSLContextFactory.scala index 7cf65f461b..f1bbe71418 100644 --- a/akka-http/src/main/scala/akka/http/javadsl/common/SSLContextFactory.scala +++ b/akka-http/src/main/scala/akka/http/javadsl/common/SSLContextFactory.scala @@ -11,13 +11,13 @@ import java.nio.file.Path import javax.net.ssl.SSLContext import java.util.{ List => JList } import akka.http.scaladsl.common.{ SSLContextFactory => ScalaSSLContextFactory } -import akka.util.JavaDurationConverters.JavaDurationOps import com.typesafe.config.Config import java.security.SecureRandom import java.time.Duration import java.util.Optional import javax.net.ssl.SSLEngine +import scala.jdk.DurationConverters._ import scala.jdk.CollectionConverters._ import scala.jdk.OptionConverters.RichOptional @@ -107,7 +107,7 @@ object SSLContextFactory { */ @ApiMayChange def refreshingSSLEngineProvider(refreshAfter: Duration)(construct: akka.japi.function.Creator[SSLContext]): akka.japi.function.Creator[SSLEngine] = - () => ScalaSSLContextFactory.refreshingSSLEngineProvider(refreshAfter.asScala)(construct.create _)() + () => ScalaSSLContextFactory.refreshingSSLEngineProvider(refreshAfter.toScala)(construct.create _)() /** * Keeps a created SSLContext around for a `refreshAfter` period, sharing it among connections, then creates a new @@ -122,5 +122,5 @@ object SSLContextFactory { */ @ApiMayChange def refreshingSSLContextProvider(refreshAfter: Duration)(construct: akka.japi.function.Creator[SSLContext]): akka.japi.function.Creator[SSLContext] = - () => ScalaSSLContextFactory.refreshingSSLContextProvider(refreshAfter.asScala)(construct.create _)() + () => ScalaSSLContextFactory.refreshingSSLContextProvider(refreshAfter.toScala)(construct.create _)() }