You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by jr...@apache.org on 2022/11/03 11:23:41 UTC
[incubator-pekko-http] 11/47: core: typing fixes to improve Scala 3 compatibility
This is an automated email from the ASF dual-hosted git repository.
jrudolph pushed a commit to branch scala-3
in repository https://gitbox.apache.org/repos/asf/incubator-pekko-http.git
commit 979ac0c1d5cc7dc8dc7db96c9e7839a62a4c264b
Author: Johannes Rudolph <jo...@gmail.com>
AuthorDate: Mon Mar 21 13:51:41 2022 +0100
core: typing fixes to improve Scala 3 compatibility
---
.../impl/engine/server/HttpServerBluePrint.scala | 2 +-
.../impl/engine/ws/WebSocketClientBlueprint.scala | 2 +-
.../akka/http/impl/util/One2OneBidiFlow.scala | 4 +--
.../http/impl/util/StageLoggingWithOverride.scala | 5 ++-
.../src/main/scala/akka/http/javadsl/Http.scala | 2 +-
.../scala/akka/http/javadsl/ServerBuilder.scala | 2 +-
.../scala/akka/http/scaladsl/ClientTransport.scala | 2 +-
.../src/main/scala/akka/http/scaladsl/Http.scala | 6 ++--
.../scala/akka/http/scaladsl/ServerBuilder.scala | 2 +-
.../scala/akka/http/scaladsl/model/ErrorInfo.scala | 2 +-
.../akka/http/scaladsl/model/HttpEntity.scala | 4 +--
.../akka/http/scaladsl/model/HttpMessage.scala | 6 ++--
.../scala/akka/http/scaladsl/model/MediaType.scala | 36 +++++++++++-----------
.../http/scaladsl/model/headers/HttpCookie.scala | 21 +++++--------
.../scaladsl/model/headers/HttpCredentials.scala | 4 +--
.../settings/ClientConnectionSettings.scala | 4 +--
.../scaladsl/settings/ConnectionPoolSettings.scala | 10 +++---
17 files changed, 53 insertions(+), 61 deletions(-)
diff --git a/akka-http-core/src/main/scala/akka/http/impl/engine/server/HttpServerBluePrint.scala b/akka-http-core/src/main/scala/akka/http/impl/engine/server/HttpServerBluePrint.scala
index 500ba8387..1ff1e3988 100644
--- a/akka-http-core/src/main/scala/akka/http/impl/engine/server/HttpServerBluePrint.scala
+++ b/akka-http-core/src/main/scala/akka/http/impl/engine/server/HttpServerBluePrint.scala
@@ -71,7 +71,7 @@ private[http] object HttpServerBluePrint {
logTLSBidiBySetting("server-plain-text", settings.logUnencryptedNetworkBytes)
val tlsSupport: BidiFlow[ByteString, SslTlsOutbound, SslTlsInbound, SessionBytes, NotUsed] =
- BidiFlow.fromFlows(Flow[ByteString].map(SendBytes), Flow[SslTlsInbound].collect { case x: SessionBytes => x })
+ BidiFlow.fromFlows(Flow[ByteString].map(SendBytes(_)), Flow[SslTlsInbound].collect { case x: SessionBytes => x })
def websocketSupport(settings: ServerSettings, log: LoggingAdapter): BidiFlow[ResponseRenderingOutput, ByteString, SessionBytes, SessionBytes, NotUsed] =
BidiFlow.fromGraph(new ProtocolSwitchStage(settings, log))
diff --git a/akka-http-core/src/main/scala/akka/http/impl/engine/ws/WebSocketClientBlueprint.scala b/akka-http-core/src/main/scala/akka/http/impl/engine/ws/WebSocketClientBlueprint.scala
index 647f9e9d3..e73fd85a8 100644
--- a/akka-http-core/src/main/scala/akka/http/impl/engine/ws/WebSocketClientBlueprint.scala
+++ b/akka-http-core/src/main/scala/akka/http/impl/engine/ws/WebSocketClientBlueprint.scala
@@ -166,5 +166,5 @@ private[http] object WebSocketClientBlueprint {
def simpleTls: BidiFlow[SslTlsInbound, ByteString, ByteString, SendBytes, NotUsed] =
BidiFlow.fromFlowsMat(
Flow[SslTlsInbound].collect { case SessionBytes(_, bytes) => bytes },
- Flow[ByteString].map(SendBytes))(Keep.none)
+ Flow[ByteString].map(SendBytes(_)))(Keep.none)
}
diff --git a/akka-http-core/src/main/scala/akka/http/impl/util/One2OneBidiFlow.scala b/akka-http-core/src/main/scala/akka/http/impl/util/One2OneBidiFlow.scala
index b07828a88..19822f125 100644
--- a/akka-http-core/src/main/scala/akka/http/impl/util/One2OneBidiFlow.scala
+++ b/akka-http-core/src/main/scala/akka/http/impl/util/One2OneBidiFlow.scala
@@ -37,8 +37,8 @@ private[http] object One2OneBidiFlow {
*/
def apply[I, O](
maxPending: Int,
- outputTruncationException: Int => Throwable = OutputTruncationException,
- unexpectedOutputException: Any => Throwable = UnexpectedOutputException): BidiFlow[I, I, O, O, NotUsed] =
+ outputTruncationException: Int => Throwable = OutputTruncationException(_),
+ unexpectedOutputException: Any => Throwable = UnexpectedOutputException(_)): BidiFlow[I, I, O, O, NotUsed] =
BidiFlow.fromGraph(new One2OneBidi[I, O](maxPending, outputTruncationException, unexpectedOutputException))
/*
diff --git a/akka-http-core/src/main/scala/akka/http/impl/util/StageLoggingWithOverride.scala b/akka-http-core/src/main/scala/akka/http/impl/util/StageLoggingWithOverride.scala
index 2ed60fe6a..7b99a8ecb 100644
--- a/akka-http-core/src/main/scala/akka/http/impl/util/StageLoggingWithOverride.scala
+++ b/akka-http-core/src/main/scala/akka/http/impl/util/StageLoggingWithOverride.scala
@@ -9,9 +9,8 @@ package akka.http.impl.util
import akka.annotation.InternalApi
import akka.stream.stage.GraphStageLogic
-import akka.event.LoggingAdapter
+import akka.event.{ LogSource, LoggingAdapter, NoLogging }
import akka.stream.ActorMaterializer
-import akka.event.NoLogging
// TODO Try to reconcile with what Akka provides in StageLogging.
// We thought this could be removed when https://github.com/akka/akka/issues/18793 had been implemented
@@ -35,7 +34,7 @@ private[akka] trait StageLoggingWithOverride { self: GraphStageLogic =>
logOverride match {
case DefaultNoLogging =>
materializer match {
- case a: ActorMaterializer => akka.event.Logging(a.system, logSource)
+ case a: ActorMaterializer => akka.event.Logging(a.system, logSource)(LogSource.fromClass)
case _ => NoLogging
}
case x => x
diff --git a/akka-http-core/src/main/scala/akka/http/javadsl/Http.scala b/akka-http-core/src/main/scala/akka/http/javadsl/Http.scala
index 6bcae7ade..d492e72aa 100644
--- a/akka-http-core/src/main/scala/akka/http/javadsl/Http.scala
+++ b/akka-http-core/src/main/scala/akka/http/javadsl/Http.scala
@@ -811,7 +811,7 @@ class Http(system: ExtendedActorSystem) extends akka.actor.Extension {
delegate.createDefaultClientHttpsContext()
private def adaptTupleFlow[T, Mat](scalaFlow: stream.scaladsl.Flow[(scaladsl.model.HttpRequest, T), (Try[scaladsl.model.HttpResponse], T), Mat]): Flow[Pair[HttpRequest, T], Pair[Try[HttpResponse], T], Mat] = {
- implicit def id[X] = JavaMapping.identity[X]
+ implicit def id[X]: JavaMapping[X, X] = JavaMapping.identity[X]
JavaMapping.toJava(scalaFlow)(JavaMapping.flowMapping[Pair[HttpRequest, T], (scaladsl.model.HttpRequest, T), Pair[Try[HttpResponse], T], (Try[scaladsl.model.HttpResponse], T), Mat, Mat])
}
diff --git a/akka-http-core/src/main/scala/akka/http/javadsl/ServerBuilder.scala b/akka-http-core/src/main/scala/akka/http/javadsl/ServerBuilder.scala
index f9bf16cc8..a3b90fc56 100644
--- a/akka-http-core/src/main/scala/akka/http/javadsl/ServerBuilder.scala
+++ b/akka-http-core/src/main/scala/akka/http/javadsl/ServerBuilder.scala
@@ -152,7 +152,7 @@ object ServerBuilder {
materializer: Materializer
) extends ServerBuilder {
private implicit def executionContext: ExecutionContext = system.classicSystem.dispatcher
- private def http: scaladsl.HttpExt = scaladsl.Http(system)
+ private def http: scaladsl.HttpExt = scaladsl.Http(system.classicSystem)
def onInterface(newInterface: String): ServerBuilder = copy(interface = newInterface)
def onPort(newPort: Int): ServerBuilder = copy(port = newPort)
diff --git a/akka-http-core/src/main/scala/akka/http/scaladsl/ClientTransport.scala b/akka-http-core/src/main/scala/akka/http/scaladsl/ClientTransport.scala
index 821d5406c..88e09ea0c 100644
--- a/akka-http-core/src/main/scala/akka/http/scaladsl/ClientTransport.scala
+++ b/akka-http-core/src/main/scala/akka/http/scaladsl/ClientTransport.scala
@@ -47,7 +47,7 @@ object ClientTransport {
}
private def connectToAddress(address: InetSocketAddress, settings: ClientConnectionSettings)(implicit system: ActorSystem): Flow[ByteString, ByteString, Future[OutgoingConnection]] = {
- Tcp().outgoingConnection(address, settings.localAddress,
+ Tcp(system.classicSystem).outgoingConnection(address, settings.localAddress,
settings.socketOptions, halfClose = true, settings.connectingTimeout, settings.idleTimeout)
.mapMaterializedValue(_.map(tcpConn => OutgoingConnection(tcpConn.localAddress, tcpConn.remoteAddress))(system.dispatcher))
}
diff --git a/akka-http-core/src/main/scala/akka/http/scaladsl/Http.scala b/akka-http-core/src/main/scala/akka/http/scaladsl/Http.scala
index 66bbfbd9a..ee66d39f1 100644
--- a/akka-http-core/src/main/scala/akka/http/scaladsl/Http.scala
+++ b/akka-http-core/src/main/scala/akka/http/scaladsl/Http.scala
@@ -10,7 +10,7 @@ import javax.net.ssl._
import akka.actor._
import akka.annotation.{ DoNotInherit, InternalApi, InternalStableApi }
import akka.dispatch.ExecutionContexts
-import akka.event.{ Logging, LoggingAdapter }
+import akka.event.{ LogSource, Logging, LoggingAdapter }
import akka.http.impl.engine.HttpConnectionIdleTimeoutBidi
import akka.http.impl.engine.client._
import akka.http.impl.engine.http2.Http2
@@ -133,7 +133,7 @@ class HttpExt @InternalStableApi /* constructor signature is hardcoded in Teleme
)
private def tcpBind(interface: String, port: Int, settings: ServerSettings): Source[Tcp.IncomingConnection, Future[Tcp.ServerBinding]] =
- Tcp()
+ Tcp(system)
.bind(
interface,
port,
@@ -1160,7 +1160,7 @@ trait DefaultSSLContextCreation {
def createClientHttpsContext(sslConfig: AkkaSSLConfig): HttpsConnectionContext = {
val config = sslConfig.config
- val log = Logging(system, getClass)
+ val log = Logging(system, getClass)(LogSource.fromClass)
val mkLogger = new AkkaLoggerFactory(system)
// initial ssl context!
diff --git a/akka-http-core/src/main/scala/akka/http/scaladsl/ServerBuilder.scala b/akka-http-core/src/main/scala/akka/http/scaladsl/ServerBuilder.scala
index 77bbc728b..821dc46f9 100644
--- a/akka-http-core/src/main/scala/akka/http/scaladsl/ServerBuilder.scala
+++ b/akka-http-core/src/main/scala/akka/http/scaladsl/ServerBuilder.scala
@@ -131,7 +131,7 @@ private[http] object ServerBuilder {
system: ClassicActorSystemProvider,
materializer: Materializer
) extends ServerBuilder {
- private val http: scaladsl.HttpExt = scaladsl.Http(system)
+ private val http: scaladsl.HttpExt = scaladsl.Http(system.classicSystem)
def onInterface(newInterface: String): ServerBuilder = copy(interface = newInterface)
def onPort(newPort: Int): ServerBuilder = copy(port = newPort)
diff --git a/akka-http-core/src/main/scala/akka/http/scaladsl/model/ErrorInfo.scala b/akka-http-core/src/main/scala/akka/http/scaladsl/model/ErrorInfo.scala
index e925034d8..6b6826e47 100644
--- a/akka-http-core/src/main/scala/akka/http/scaladsl/model/ErrorInfo.scala
+++ b/akka-http-core/src/main/scala/akka/http/scaladsl/model/ErrorInfo.scala
@@ -17,7 +17,7 @@ final class ErrorInfo(
val summary: String = "",
val detail: String = "",
val errorHeaderName: String = ""
-) extends scala.Product with scala.Serializable with scala.Equals with java.io.Serializable {
+) extends scala.Product with scala.Equals with java.io.Serializable {
def withSummary(newSummary: String) = copy(summary = newSummary)
def withSummaryPrepended(prefix: String) = withSummary(if (summary.isEmpty) prefix else prefix + ": " + summary)
def withErrorHeaderName(headerName: String) = new ErrorInfo(summary, detail, headerName.toLowerCase)
diff --git a/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpEntity.scala b/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpEntity.scala
index acb066675..ee0015193 100644
--- a/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpEntity.scala
+++ b/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpEntity.scala
@@ -634,12 +634,12 @@ object HttpEntity {
override val shape = FlowShape.of(in, out)
override protected val initialAttributes: Attributes = Limitable.limitableDefaults
- override def createLogic(attributes: Attributes): GraphStageLogic = new GraphStageLogic(shape) with InHandler with OutHandler {
+ override def createLogic(_attributes: Attributes): GraphStageLogic = new GraphStageLogic(shape) with InHandler with OutHandler {
private var maxBytes = -1L
private var bytesLeft = Long.MaxValue
override def preStart(): Unit = {
- attributes.getFirst[SizeLimit] match {
+ _attributes.getFirst[SizeLimit] match {
case Some(limit: SizeLimit) if limit.isDisabled =>
// "no limit"
case Some(SizeLimit(bytes, cl @ Some(contentLength))) =>
diff --git a/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpMessage.scala b/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpMessage.scala
index a56c1757a..85aafc83c 100644
--- a/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpMessage.scala
+++ b/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpMessage.scala
@@ -216,10 +216,8 @@ sealed trait HttpMessage extends jm.HttpMessage {
/** Java API */
def addHeaders(headers: JIterable[jm.HttpHeader]): Self = withHeaders(this.headers ++ headers.asScala.asInstanceOf[Iterable[HttpHeader]])
/** Java API */
- def withHeaders(headers: JIterable[jm.HttpHeader]): Self = {
- import JavaMapping.Implicits._
- withHeaders(headers.asScala.toVector.map(_.asScala))
- }
+ def withHeaders(headers: JIterable[jm.HttpHeader]): Self =
+ withHeaders(headers.asScala.toVector.map(x => JavaMapping.toScala(x))
/** Java API */
def getAttribute[T](attributeKey: jm.AttributeKey[T]): Optional[T] =
Util.convertOption(attribute(attributeKey))
diff --git a/akka-http-core/src/main/scala/akka/http/scaladsl/model/MediaType.scala b/akka-http-core/src/main/scala/akka/http/scaladsl/model/MediaType.scala
index c2bdf2f97..1c03d9551 100644
--- a/akka-http-core/src/main/scala/akka/http/scaladsl/model/MediaType.scala
+++ b/akka-http-core/src/main/scala/akka/http/scaladsl/model/MediaType.scala
@@ -131,12 +131,12 @@ object MediaType {
val _params = params
new Binary(renderValue(mainType, subType, params), mainType, subType, comp, fileExtensions) {
override def params = _params
- override def isApplication = mainType == "application"
- override def isAudio = mainType == "audio"
- override def isImage = mainType == "image"
- override def isMessage = mainType == "message"
- override def isText = mainType == "text"
- override def isVideo = mainType == "video"
+ override def isApplication = this.mainType == "application"
+ override def isAudio = this.mainType == "audio"
+ override def isImage = this.mainType == "image"
+ override def isMessage = this.mainType == "message"
+ override def isText = this.mainType == "text"
+ override def isVideo = this.mainType == "video"
}
}
@@ -148,12 +148,12 @@ object MediaType {
val _params = params
new WithFixedCharset(renderValue(mainType, subType, params), mainType, subType, charset, fileExtensions) {
override def params = _params
- override def isApplication = mainType == "application"
- override def isAudio = mainType == "audio"
- override def isImage = mainType == "image"
- override def isMessage = mainType == "message"
- override def isText = mainType == "text"
- override def isVideo = mainType == "video"
+ override def isApplication = this.mainType == "application"
+ override def isAudio = this.mainType == "audio"
+ override def isImage = this.mainType == "image"
+ override def isMessage = this.mainType == "message"
+ override def isText = this.mainType == "text"
+ override def isVideo = this.mainType == "video"
}
}
@@ -165,12 +165,12 @@ object MediaType {
val _params = params
new NonMultipartWithOpenCharset(renderValue(mainType, subType, params), mainType, subType, fileExtensions) {
override def params = _params
- override def isApplication = mainType == "application"
- override def isAudio = mainType == "audio"
- override def isImage = mainType == "image"
- override def isMessage = mainType == "message"
- override def isText = mainType == "text"
- override def isVideo = mainType == "video"
+ override def isApplication = this.mainType == "application"
+ override def isAudio = this.mainType == "audio"
+ override def isImage = this.mainType == "image"
+ override def isMessage = this.mainType == "message"
+ override def isText = this.mainType == "text"
+ override def isVideo = this.mainType == "video"
}
}
diff --git a/akka-http-core/src/main/scala/akka/http/scaladsl/model/headers/HttpCookie.scala b/akka-http-core/src/main/scala/akka/http/scaladsl/model/headers/HttpCookie.scala
index 2969f9665..51fbbf712 100644
--- a/akka-http-core/src/main/scala/akka/http/scaladsl/model/headers/HttpCookie.scala
+++ b/akka-http-core/src/main/scala/akka/http/scaladsl/model/headers/HttpCookie.scala
@@ -57,14 +57,14 @@ object HttpCookiePair {
* http://tools.ietf.org/html/rfc6265
*/
final class HttpCookie private[http] (
- name: String,
- value: String,
+ val name: String,
+ val value: String,
val expires: Option[DateTime],
val maxAge: Option[Long],
val domain: Option[String],
val path: Option[String],
- secure: Boolean,
- httpOnly: Boolean,
+ val secure: Boolean,
+ val httpOnly: Boolean,
val extension: Option[String],
val sameSite: Option[SameSite]) extends jm.headers.HttpCookie with ToStringRenderable with Product with Serializable with Equals {
@@ -162,11 +162,6 @@ final class HttpCookie private[http] (
r
}
- override def name(): String = this.name
- override def value(): String = this.value
- override def secure(): Boolean = this.secure
- override def httpOnly(): Boolean = this.httpOnly
-
/** Java API */
def getSameSite: Optional[jm.headers.SameSite] = sameSite.map(_.asJava).asJava
/** Java API */
@@ -223,14 +218,14 @@ object HttpCookie {
@deprecated("Pattern matching on HttpCookie is deprecated because of the big number of fields and potential future compatibility hazards. Please use other means to check the fields.", since = "10.2.0")
def unapply(cookie: HttpCookie) = Option((
- cookie.name(),
- cookie.value(),
+ cookie.name,
+ cookie.value,
cookie.expires,
cookie.maxAge,
cookie.domain,
cookie.path,
- cookie.secure(),
- cookie.httpOnly(),
+ cookie.secure,
+ cookie.httpOnly,
cookie.extension
))
diff --git a/akka-http-core/src/main/scala/akka/http/scaladsl/model/headers/HttpCredentials.scala b/akka-http-core/src/main/scala/akka/http/scaladsl/model/headers/HttpCredentials.scala
index ca1d1fc9d..0d5bc9795 100644
--- a/akka-http-core/src/main/scala/akka/http/scaladsl/model/headers/HttpCredentials.scala
+++ b/akka-http-core/src/main/scala/akka/http/scaladsl/model/headers/HttpCredentials.scala
@@ -23,7 +23,7 @@ final case class BasicHttpCredentials(username: String, password: String) extend
val cookie = {
val userPass = username + ':' + password
val bytes = userPass.getBytes(`UTF-8`.nioCharset)
- Base64.rfc2045.encodeToChar(bytes, false)
+ Base64.rfc2045().encodeToChar(bytes, false)
}
def render[R <: Rendering](r: R): r.type = r ~~ "Basic " ~~ cookie
@@ -34,7 +34,7 @@ final case class BasicHttpCredentials(username: String, password: String) extend
object BasicHttpCredentials {
def apply(credentials: String): BasicHttpCredentials = {
- val bytes = Base64.rfc2045.decodeFast(credentials)
+ val bytes = Base64.rfc2045().decodeFast(credentials)
val userPass = new String(bytes, `UTF-8`.nioCharset)
userPass.indexOf(':') match {
case -1 => apply(userPass, "")
diff --git a/akka-http-core/src/main/scala/akka/http/scaladsl/settings/ClientConnectionSettings.scala b/akka-http-core/src/main/scala/akka/http/scaladsl/settings/ClientConnectionSettings.scala
index d9313d0a1..97cadd7b3 100644
--- a/akka-http-core/src/main/scala/akka/http/scaladsl/settings/ClientConnectionSettings.scala
+++ b/akka-http-core/src/main/scala/akka/http/scaladsl/settings/ClientConnectionSettings.scala
@@ -52,7 +52,7 @@ abstract class ClientConnectionSettings private[akka] () extends akka.http.javad
// overloads for idiomatic Scala use
def withWebsocketSettings(newValue: WebSocketSettings): ClientConnectionSettings = self.copy(websocketSettings = newValue)
- def withWebsocketRandomFactory(newValue: () => Random): ClientConnectionSettings = withWebsocketSettings(websocketSettings.withRandomFactoryFactory(new Supplier[Random] {
+ def withWebsocketRandomFactory(newValue: () => Random): ClientConnectionSettings = withWebsocketSettings(self.websocketSettings.withRandomFactoryFactory(new Supplier[Random] {
override def get(): Random = newValue()
}))
def withUserAgentHeader(newValue: Option[`User-Agent`]): ClientConnectionSettings = self.copy(userAgentHeader = newValue)
@@ -66,7 +66,7 @@ abstract class ClientConnectionSettings private[akka] () extends akka.http.javad
def withTransport(newTransport: ClientTransport): ClientConnectionSettings = self.copy(transport = newTransport)
// Scala-only lenses
- def mapHttp2Settings(f: Http2ClientSettings => Http2ClientSettings): ClientConnectionSettings = withHttp2Settings(f(http2Settings))
+ def mapHttp2Settings(f: Http2ClientSettings => Http2ClientSettings): ClientConnectionSettings = withHttp2Settings(f(self.http2Settings))
/**
* Returns a new instance with the given local address set if the given override is `Some(address)`, otherwise
diff --git a/akka-http-core/src/main/scala/akka/http/scaladsl/settings/ConnectionPoolSettings.scala b/akka-http-core/src/main/scala/akka/http/scaladsl/settings/ConnectionPoolSettings.scala
index 6abb12a8a..603142903 100644
--- a/akka-http-core/src/main/scala/akka/http/scaladsl/settings/ConnectionPoolSettings.scala
+++ b/akka-http-core/src/main/scala/akka/http/scaladsl/settings/ConnectionPoolSettings.scala
@@ -38,13 +38,13 @@ abstract class ConnectionPoolSettings extends js.ConnectionPoolSettings { self:
* the first matching set of overrides is selected.
*/
private[akka] def forHost(host: String): ConnectionPoolSettings =
- hostOverrides.collectFirst { case (regex, overrides) if regex.pattern.matcher(host).matches() => overrides }.getOrElse(this)
+ self.hostOverrides.collectFirst { case (regex, overrides) if regex.pattern.matcher(host).matches() => overrides }.getOrElse(this)
/**
* The underlying transport used to connect to hosts. By default [[ClientTransport.TCP]] is used.
*/
@deprecated("Deprecated in favor of connectionSettings.transport", "10.1.0")
- def transport: ClientTransport = connectionSettings.transport
+ def transport: ClientTransport = self.connectionSettings.transport
/** The time after which the pool will drop an entity automatically if it wasn't read or discarded */
@ApiMayChange
@@ -53,10 +53,10 @@ abstract class ConnectionPoolSettings extends js.ConnectionPoolSettings { self:
// ---
@ApiMayChange
- def withHostOverrides(hostOverrides: immutable.Seq[(String, ConnectionPoolSettings)]): ConnectionPoolSettings = self.copy(hostOverrides = hostOverrides.map { case (h, s) => ConnectionPoolSettingsImpl.hostRegex(h) -> s })
+ def withHostOverrides(hostOverrides: immutable.Seq[(String, ConnectionPoolSettings)]): ConnectionPoolSettings = self.copy(hostOverrides = self.hostOverrides.map { case (h, s) => ConnectionPoolSettingsImpl.hostRegex(h) -> s })
@ApiMayChange
- def appendHostOverride(hostPattern: String, settings: ConnectionPoolSettings): ConnectionPoolSettings = self.copy(hostOverrides = hostOverrides :+ (ConnectionPoolSettingsImpl.hostRegex(hostPattern) -> settings))
+ def appendHostOverride(hostPattern: String, settings: ConnectionPoolSettings): ConnectionPoolSettings = self.copy(hostOverrides = self.hostOverrides :+ (ConnectionPoolSettingsImpl.hostRegex(hostPattern) -> settings))
override def withMaxConnections(n: Int): ConnectionPoolSettings = self.copyDeep(_.withMaxConnections(n), maxConnections = n)
override def withMinConnections(n: Int): ConnectionPoolSettings = self.copyDeep(_.withMinConnections(n), minConnections = n)
@@ -78,7 +78,7 @@ abstract class ConnectionPoolSettings extends js.ConnectionPoolSettings { self:
* `withUpdatedConnectionSettings(_.withTransport(newTransport))`.
*/
def withTransport(newValue: ClientTransport): ConnectionPoolSettings =
- withUpdatedConnectionSettings(_.withTransport(newValue))
+ self.withUpdatedConnectionSettings(_.withTransport(newValue))
def withUpdatedConnectionSettings(f: ClientConnectionSettings => ClientConnectionSettings): ConnectionPoolSettings
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org