Skip to content

Commit 9fc23fb

Browse files
authored
build with pekko 2.0.0-M1 (#779)
* Update validate-and-test.yml updates more changes remove Java 8 specific code Update StringTools.scala use Java 17 in build snapshot dependency start to remove use of PekkoSSLConfig update Update ConnectionContext.scala Update remove-deprecated-methods.excludes try SNI matcher Update ClientServerSpec.scala try to fix test remove bindAndHandleAsync remove use of deprecated TLS methods begin removing deprecations Update HttpChallenge.java Update CorsSettings.scala encoder Update CookieDirectivesExamplesTest.java Update SizeLimitSpec.scala compile issues Update Encoder.scala mima Update Encoder.scala Update Encoder.scala more changes issues Update SizeLimitSpec.scala rename file more more Update HeaderDirectivesSpec.scala Update remove-deprecated-methods.excludes more move mima unused imports Update ServerSettingsImpl.scala Update ServerSettings.scala start to remove use of PekkoSSLConfig update Update ConnectionContext.scala Update remove-deprecated-methods.excludes try SNI matcher Update ClientServerSpec.scala try to fix test Update remove-deprecated-methods.excludes remove use of deprecated TLS methods Update remove-deprecated-methods.excludes HttpChallenge more deprecations javafmt Delete remove-deprecated-methods.excludes * Update ExceptionHandlerBuilder.java * remove use of ActorMaterializer * Update StageLoggingWithOverride.scala * old way to get subscriptionTimeoutSettings not accessible any more * mima * Update uptake-pekko-core-2.0.0.excludes * compile issues with watchTermination() * Update PekkoCoreDependency.scala * Update PekkoCoreDependency.scala * Update reference.conf * Remove Apache Maven Staging Repo from resolvers
1 parent 1a96655 commit 9fc23fb

File tree

13 files changed

+65
-26
lines changed

13 files changed

+65
-26
lines changed

docs/src/test/scala/docs/http/scaladsl/HttpServerExampleSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class HttpServerExampleSpec extends AnyWordSpec with Matchers
111111
val failureMonitor: ActorRef = system.actorOf(MyExampleMonitoringActor.props)
112112

113113
val reactToTopLevelFailures = Flow[IncomingConnection]
114-
.watchTermination()((_, termination) =>
114+
.watchTermination((_, termination) =>
115115
termination.failed.foreach {
116116
cause => failureMonitor ! cause
117117
})
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# changes needed to uptake Pekko Core 2.0.0
19+
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.impl.engine.client.PoolInterface#Logic.onDownstreamFinish")
20+
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.impl.engine.http2.Http2StreamHandling#IncomingStreamBuffer.onDownstreamFinish")
21+
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.impl.engine.http2.hpack.HandleOrPassOnStage#State.onDownstreamFinish")

http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ private[http] final class Http2Ext(implicit val system: ActorSystem)
106106
(incoming: Tcp.IncomingConnection) =>
107107
try {
108108
httpPlusSwitching(http1, http2).addAttributes(prepareServerAttributes(settings, incoming))
109-
.watchTermination() {
109+
.watchTermination {
110110
case (connectionTerminatorF, future) =>
111111
connectionTerminatorF.foreach { connectionTerminator =>
112112
masterTerminator.registerConnection(connectionTerminator)(fm.executionContext)
@@ -170,7 +170,7 @@ private[http] final class Http2Ext(implicit val system: ActorSystem)
170170

171171
val serverLayer: Flow[ByteString, ByteString, Future[Done]] = Flow.fromGraph(
172172
Flow[HttpRequest]
173-
.watchTermination()(Keep.right)
173+
.watchTermination(Keep.right)
174174
.prepend(injectedRequest)
175175
.via(Http2Blueprint.handleWithStreamIdHeader(settings.http2Settings.maxConcurrentStreams)(handler)(
176176
system.dispatcher))

http-core/src/main/scala/org/apache/pekko/http/impl/engine/server/HttpServerBluePrint.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -721,12 +721,11 @@ private[http] object HttpServerBluePrint {
721721
})
722722

723723
private var activeTimers = 0
724-
private val timeout: FiniteDuration = {
724+
private val timeout: FiniteDuration =
725725
inheritedAttributes.get[ActorAttributes.StreamSubscriptionTimeout] match {
726726
case Some(attr) => attr.timeout
727727
case None => 5.minutes // should not happen
728728
}
729-
}
730729
private def addTimeout(s: SubscriptionTimeout): Unit = {
731730
if (activeTimers == 0) setKeepGoing(true)
732731
activeTimers += 1

http-core/src/main/scala/org/apache/pekko/http/impl/util/StageLoggingWithOverride.scala

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ package org.apache.pekko.http.impl.util
1919
import org.apache.pekko
2020
import pekko.annotation.InternalApi
2121
import pekko.stream.stage.GraphStageLogic
22-
import pekko.event.{ LogSource, LoggingAdapter, NoLogging }
23-
import pekko.stream.ActorMaterializer
22+
import pekko.event.{ LogSource, LoggingAdapter }
2423

2524
// TODO Try to reconcile with what Pekko provides in StageLogging.
2625
// We thought this could be removed when https://github.com/akka/akka/issues/18793 had been implemented
@@ -43,10 +42,7 @@ private[pekko] trait StageLoggingWithOverride extends GraphStageLogic {
4342
_log =
4443
logOverride match {
4544
case DefaultNoLogging =>
46-
materializer match {
47-
case a: ActorMaterializer => pekko.event.Logging(a.system, logSource)(LogSource.fromClass)
48-
case _ => NoLogging
49-
}
45+
pekko.event.Logging(materializer.system, logSource)(LogSource.fromClass)
5046
case x => x
5147
}
5248
case _ =>

http-core/src/main/scala/org/apache/pekko/http/scaladsl/Http.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ class HttpExt @InternalStableApi /* constructor signature is hardcoded in Teleme
121121
handler: Flow[HttpRequest, HttpResponse, Any]): ServerLayerFlow =
122122
Flow.fromGraph(
123123
Flow[HttpRequest]
124-
.watchTermination()(Keep.right)
124+
.watchTermination(Keep.right)
125125
.via(handler)
126-
.watchTermination() { (termWatchBefore, termWatchAfter) =>
126+
.watchTermination { (termWatchBefore, termWatchAfter) =>
127127
// flag termination when the user handler has gotten (or has emitted) termination
128128
// signals in both directions
129129
termWatchBefore.flatMap(_ => termWatchAfter)(ExecutionContext.parasitic)
@@ -234,7 +234,7 @@ class HttpExt @InternalStableApi /* constructor signature is hardcoded in Teleme
234234
.mapAsyncUnordered(settings.maxConnections) { incoming =>
235235
try {
236236
fullLayer
237-
.watchTermination() {
237+
.watchTermination {
238238
case ((done, connectionTerminator), whenTerminates) =>
239239
whenTerminates.onComplete { _ =>
240240
masterTerminator.removeConnection(connectionTerminator)

http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/HostConnectionPoolSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ class HostConnectionPoolSpec extends PekkoSpecWithMaterializer(
700700
Sink.fromSubscriber(serverRequests),
701701
Source.fromPublisher(serverResponses))
702702
.joinMat(clientServerImplementation.get(killSwitch))(Keep.right)
703-
.watchTermination()(Keep.both)
703+
.watchTermination(Keep.both)
704704
.join(
705705
Flow.fromSinkAndSource(
706706
Sink.fromSubscriber(responseSubscriber),

http-core/src/test/scala/org/apache/pekko/http/impl/engine/ws/WSClientAutobahnTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ object WSClientAutobahnTest extends App {
173173
Http().singleWebSocketRequest(uri, clientFlow)._2
174174

175175
def completionSignal[T]: Flow[T, T, Future[Done]] =
176-
Flow[T].watchTermination()((_, res) => res)
176+
Flow[T].watchTermination((_, res) => res)
177177

178178
/**
179179
* The autobahn tests define a weird API where every request must be a WebSocket request and

http-core/src/test/scala/org/apache/pekko/http/impl/engine/ws/WebSocketIntegrationSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ class WebSocketIntegrationSpec extends PekkoSpecWithMaterializer(
210210
val handlerTermination = Promise[Done]()
211211

212212
val handler = Flow[Message]
213-
.watchTermination()(Keep.right)
213+
.watchTermination(Keep.right)
214214
.mapMaterializedValue(handlerTermination.completeWith(_))
215215
.map(m => TextMessage.Strict(s"Echo [${m.asTextMessage.getStrictText}]"))
216216

http/src/main/java/org/apache/pekko/http/javadsl/server/ExceptionHandlerBuilder.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313

1414
package org.apache.pekko.http.javadsl.server;
1515

16-
import org.apache.pekko.japi.pf.FI;
16+
import org.apache.pekko.japi.function.Function;
17+
import org.apache.pekko.japi.function.Predicate;
1718
import org.apache.pekko.japi.pf.PFBuilder;
1819

1920
public class ExceptionHandlerBuilder {
@@ -35,7 +36,7 @@ private ExceptionHandlerBuilder(PFBuilder<Throwable, Route> delegate) {
3536
* @return a builder with the case statement added
3637
*/
3738
public <P extends Throwable> ExceptionHandlerBuilder match(
38-
final Class<P> type, FI.Apply<P, Route> apply) {
39+
final Class<P> type, final Function<P, Route> apply) {
3940
delegate.match(type, apply);
4041
return this;
4142
}
@@ -50,7 +51,7 @@ public <P extends Throwable> ExceptionHandlerBuilder match(
5051
* @return a builder with the case statement added
5152
*/
5253
public <P extends Throwable> ExceptionHandlerBuilder match(
53-
final Class<P> type, final FI.TypedPredicate<P> predicate, final FI.Apply<P, Route> apply) {
54+
final Class<P> type, final Predicate<P> predicate, final Function<P, Route> apply) {
5455
delegate.match(type, predicate, apply);
5556
return this;
5657
}
@@ -63,7 +64,7 @@ public <P extends Throwable> ExceptionHandlerBuilder match(
6364
* @return a builder with the case statement added
6465
*/
6566
public <P extends Throwable> ExceptionHandlerBuilder matchEquals(
66-
final P object, final FI.Apply<P, Route> apply) {
67+
final P object, final Function<P, Route> apply) {
6768
delegate.matchEquals(object, apply);
6869
return this;
6970
}
@@ -74,7 +75,7 @@ public <P extends Throwable> ExceptionHandlerBuilder matchEquals(
7475
* @param apply an action to apply to the argument
7576
* @return a builder with the case statement added
7677
*/
77-
public ExceptionHandlerBuilder matchAny(final FI.Apply<Throwable, Route> apply) {
78+
public ExceptionHandlerBuilder matchAny(final Function<Throwable, Route> apply) {
7879
delegate.matchAny(apply);
7980
return this;
8081
}

0 commit comments

Comments
 (0)