diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index b41ee033..1fc80148 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -22,11 +22,11 @@ jobs: # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves fetch-depth: 0 - - name: Setup Java 11 + - name: Setup Java 17 uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0 with: distribution: temurin - java-version: 11 + java-version: 17 - name: Install sbt uses: sbt/setup-sbt@b113b960ba361e87e08ce02a390d51871b7ee459 # v1.5.13 diff --git a/.github/workflows/publish-nightly.yml b/.github/workflows/publish-nightly.yml index edb80072..d57fde11 100644 --- a/.github/workflows/publish-nightly.yml +++ b/.github/workflows/publish-nightly.yml @@ -37,11 +37,11 @@ jobs: # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves fetch-depth: 0 - - name: Setup Java 11 + - name: Setup Java 17 uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0 with: distribution: temurin - java-version: 11 + java-version: 17 - name: Cache Coursier cache uses: coursier/cache-action@ee0650f98295f27a505e4bfd284c9bfaa913a465 # v9.0.1 diff --git a/docs-gen/.sbtopts b/docs-gen/.sbtopts new file mode 100644 index 00000000..1ca6d0b3 --- /dev/null +++ b/docs-gen/.sbtopts @@ -0,0 +1 @@ +-J-Xmx2G diff --git a/docs-gen/project/build.properties b/docs-gen/project/build.properties index df061f4f..36860735 100644 --- a/docs-gen/project/build.properties +++ b/docs-gen/project/build.properties @@ -1 +1 @@ -sbt.version=1.12.9 +sbt.version=1.13.1 diff --git a/docs-gen/project/plugins.sbt b/docs-gen/project/plugins.sbt index 3266aba0..b54fbf94 100644 --- a/docs-gen/project/plugins.sbt +++ b/docs-gen/project/plugins.sbt @@ -1 +1,3 @@ addSbtPlugin("org.apache.pekko" % "pekko-sbt-paradox" % "1.0.1") +addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.11.1") +addSbtPlugin("com.lightbend.paradox" % "sbt-paradox-theme" % "0.11.1") diff --git a/pekko-sample-cluster-client-grpc-java/.mvn/jvm.config b/pekko-sample-cluster-client-grpc-java/.mvn/jvm.config new file mode 100644 index 00000000..4df36e78 --- /dev/null +++ b/pekko-sample-cluster-client-grpc-java/.mvn/jvm.config @@ -0,0 +1 @@ +--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED diff --git a/pekko-sample-cluster-client-grpc-java/pom.xml b/pekko-sample-cluster-client-grpc-java/pom.xml index de95cad5..9abc63b7 100644 --- a/pekko-sample-cluster-client-grpc-java/pom.xml +++ b/pekko-sample-cluster-client-grpc-java/pom.xml @@ -10,9 +10,11 @@ UTF-8 - 1.5.0 - 1.2.0 + 2.0.0 + 2.0.0-M2 3 + + --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED @@ -67,8 +69,7 @@ maven-compiler-plugin 3.8.1 - 1.8 - 1.8 + 17 true -Xlint diff --git a/pekko-sample-cluster-client-grpc-java/src/main/java/sample/cluster/client/grpc/ClusterClient.java b/pekko-sample-cluster-client-grpc-java/src/main/java/sample/cluster/client/grpc/ClusterClient.java index c62be6f4..98f1819c 100644 --- a/pekko-sample-cluster-client-grpc-java/src/main/java/sample/cluster/client/grpc/ClusterClient.java +++ b/pekko-sample-cluster-client-grpc-java/src/main/java/sample/cluster/client/grpc/ClusterClient.java @@ -157,12 +157,11 @@ private static CompletionStage newSession( // never fail from stream element elem -> Optional.empty(), settings.bufferSize, - OverflowStrategy.dropNew() + OverflowStrategy.dropTail() ) .via(killSwitch.flow()) .map(msg -> { - if (msg instanceof Send) { - Send send = (Send) msg; + if (msg instanceof Send send) { Payload payload = serialization.serializePayload(send.msg); return Req.newBuilder() .setSend(SendReq.newBuilder() @@ -170,16 +169,14 @@ private static CompletionStage newSession( .setLocalAffinity(send.localAffinity) .setPayload(payload)) .build(); - } else if (msg instanceof SendToAll) { - SendToAll sendToAll = (SendToAll) msg; + } else if (msg instanceof SendToAll sendToAll) { Payload payload = serialization.serializePayload(sendToAll.msg); return Req.newBuilder() .setSendToAll(SendToAllReq.newBuilder() .setPath(sendToAll.path) .setPayload(payload)) .build(); - } else if (msg instanceof Publish) { - Publish publish = (Publish) msg; + } else if (msg instanceof Publish publish) { Payload payload = serialization.serializePayload(publish.msg); return Req.newBuilder() .setPublish(PublishReq.newBuilder() diff --git a/pekko-sample-cluster-client-grpc-java/src/main/java/sample/cluster/client/grpc/ClusterClientReceptionistGrpcImpl.java b/pekko-sample-cluster-client-grpc-java/src/main/java/sample/cluster/client/grpc/ClusterClientReceptionistGrpcImpl.java index 71bca704..6e03dd22 100644 --- a/pekko-sample-cluster-client-grpc-java/src/main/java/sample/cluster/client/grpc/ClusterClientReceptionistGrpcImpl.java +++ b/pekko-sample-cluster-client-grpc-java/src/main/java/sample/cluster/client/grpc/ClusterClientReceptionistGrpcImpl.java @@ -40,7 +40,7 @@ public Source newSession(Source in) { // never fail from stream element elem -> Optional.empty(), settings.bufferSize, - OverflowStrategy.dropNew()) + OverflowStrategy.dropTail()) .map( rsp -> { Payload payload = serialization.serializePayload(rsp); return Rsp.newBuilder().setPayload(payload).build(); diff --git a/pekko-sample-cluster-client-grpc-scala/.jvmopts b/pekko-sample-cluster-client-grpc-scala/.jvmopts new file mode 100644 index 00000000..4df36e78 --- /dev/null +++ b/pekko-sample-cluster-client-grpc-scala/.jvmopts @@ -0,0 +1 @@ +--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED diff --git a/pekko-sample-cluster-client-grpc-scala/build.sbt b/pekko-sample-cluster-client-grpc-scala/build.sbt index 75bcf4fb..22cfb8ce 100644 --- a/pekko-sample-cluster-client-grpc-scala/build.sbt +++ b/pekko-sample-cluster-client-grpc-scala/build.sbt @@ -1,6 +1,7 @@ import com.typesafe.sbt.MultiJvmPlugin.multiJvmSettings -val pekkoVersion = "1.5.0" +ThisBuild / evictionErrorLevel := Level.Info +val pekkoVersion = "2.0.0" lazy val `pekko-sample-cluster-client-grpc-scala` = project .in(file(".")) @@ -9,7 +10,9 @@ lazy val `pekko-sample-cluster-client-grpc-scala` = project .settings(multiJvmSettings: _*) .settings( organization := "org.apache.pekko", - scalaVersion := "3.3.7", + // Agrona (used by pekko-remote Artery) needs access to jdk.internal.misc.Unsafe + MultiJvm / jvmOptions ++= Seq("--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED"), + scalaVersion := "3.3.9", Compile / scalacOptions ++= Seq( "-deprecation", "-feature", diff --git a/pekko-sample-cluster-client-grpc-scala/project/build.properties b/pekko-sample-cluster-client-grpc-scala/project/build.properties index df061f4f..36860735 100644 --- a/pekko-sample-cluster-client-grpc-scala/project/build.properties +++ b/pekko-sample-cluster-client-grpc-scala/project/build.properties @@ -1 +1 @@ -sbt.version=1.12.9 +sbt.version=1.13.1 diff --git a/pekko-sample-cluster-client-grpc-scala/project/plugins.sbt b/pekko-sample-cluster-client-grpc-scala/project/plugins.sbt index d460e3f7..ab5b1e91 100644 --- a/pekko-sample-cluster-client-grpc-scala/project/plugins.sbt +++ b/pekko-sample-cluster-client-grpc-scala/project/plugins.sbt @@ -1,3 +1,3 @@ -addSbtPlugin("org.apache.pekko" % "pekko-grpc-sbt-plugin" % "1.2.0") +addSbtPlugin("org.apache.pekko" % "pekko-grpc-sbt-plugin" % "2.0.0-M2") addSbtPlugin("com.github.sbt" % "sbt-javaagent" % "0.2.0") addSbtPlugin("com.github.sbt" % "sbt-multi-jvm" % "0.6.0") diff --git a/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClient.scala b/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClient.scala index 6354e555..7c2368d3 100644 --- a/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClient.scala +++ b/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClient.scala @@ -65,12 +65,12 @@ object ClusterClient { Source .actorRef[Any]( bufferSize = settings.bufferSize, - overflowStrategy = OverflowStrategy.dropNew, + overflowStrategy = OverflowStrategy.dropTail, // never complete from stream element completionMatcher = PartialFunction.empty, // never fail from stream element failureMatcher = PartialFunction.empty) - // .actorRef[Any](bufferSize = settings.bufferSize, overflowStrategy = OverflowStrategy.dropNew) + // .actorRef[Any](bufferSize = settings.bufferSize, overflowStrategy = OverflowStrategy.dropTail) .via(killSwitch.flow) .map { case send: Send => diff --git a/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionist.scala b/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionist.scala index 48764c53..0de0b3d0 100644 --- a/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionist.scala +++ b/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionist.scala @@ -17,7 +17,6 @@ import org.apache.pekko.cluster.pubsub.DistributedPubSub import org.apache.pekko.cluster.pubsub.DistributedPubSubMediator import org.apache.pekko.event.Logging import org.apache.pekko.http.scaladsl.Http -import org.apache.pekko.http.scaladsl.HttpConnectionContext import org.apache.pekko.http.scaladsl.model.HttpRequest import org.apache.pekko.http.scaladsl.model.HttpResponse import org.apache.pekko.stream.Materializer @@ -100,11 +99,7 @@ final class ClusterClientReceptionist(system: ExtendedActorSystem) extends Exten ClusterClientReceptionistServiceHandler( new ClusterClientReceptionistGrpcImpl(settings, pubSubMediator, serialization)(materializer, log)) - Http().bindAndHandleAsync( - service, - interface = settings.hostPort.hostname, - settings.hostPort.port, - connectionContext = HttpConnectionContext()) + Http().newServerAt(settings.hostPort.hostname, settings.hostPort.port).bind(service) } server.onComplete { result => diff --git a/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionistGrpcImpl.scala b/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionistGrpcImpl.scala index df2459ea..03636aea 100644 --- a/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionistGrpcImpl.scala +++ b/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionistGrpcImpl.scala @@ -28,7 +28,7 @@ class ClusterClientReceptionistGrpcImpl( Source .actorRef[Any]( bufferSize = settings.bufferSize, - overflowStrategy = OverflowStrategy.dropNew, + overflowStrategy = OverflowStrategy.dropTail, // never complete from stream element completionMatcher = PartialFunction.empty, // never fail from stream element diff --git a/pekko-sample-cluster-docker-compose-java/.jvmopts b/pekko-sample-cluster-docker-compose-java/.jvmopts new file mode 100644 index 00000000..4df36e78 --- /dev/null +++ b/pekko-sample-cluster-docker-compose-java/.jvmopts @@ -0,0 +1 @@ +--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED diff --git a/pekko-sample-cluster-docker-compose-java/build.sbt b/pekko-sample-cluster-docker-compose-java/build.sbt index 8ddb2471..861c3531 100644 --- a/pekko-sample-cluster-docker-compose-java/build.sbt +++ b/pekko-sample-cluster-docker-compose-java/build.sbt @@ -1,7 +1,7 @@ organization := "org.apache.pekko" /* scala versions and options */ -scalaVersion := "3.3.7" +scalaVersion := "3.3.9" // These options will be used for *all* versions. scalacOptions ++= Seq( @@ -9,7 +9,7 @@ scalacOptions ++= Seq( "-unchecked", "-encoding", "UTF-8") -val pekkoVersion = "1.5.0" +val pekkoVersion = "2.0.0" val logbackVersion = "1.3.15" /* dependencies */ @@ -28,5 +28,7 @@ Docker / dockerEntrypoint := Seq("sh", "-c", "bin/clustering $*") dockerRepository := Some("pekko") -dockerBaseImage := "eclipse-temurin:11" +dockerBaseImage := "eclipse-temurin:17" +// Agrona (used by pekko-remote Artery) needs access to jdk.internal.misc.Unsafe +bashScriptExtraDefines += """addJava "--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED"""" enablePlugins(JavaAppPackaging) diff --git a/pekko-sample-cluster-docker-compose-java/project/build.properties b/pekko-sample-cluster-docker-compose-java/project/build.properties index df061f4f..36860735 100644 --- a/pekko-sample-cluster-docker-compose-java/project/build.properties +++ b/pekko-sample-cluster-docker-compose-java/project/build.properties @@ -1 +1 @@ -sbt.version=1.12.9 +sbt.version=1.13.1 diff --git a/pekko-sample-cluster-docker-compose-scala/.jvmopts b/pekko-sample-cluster-docker-compose-scala/.jvmopts new file mode 100644 index 00000000..4df36e78 --- /dev/null +++ b/pekko-sample-cluster-docker-compose-scala/.jvmopts @@ -0,0 +1 @@ +--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED diff --git a/pekko-sample-cluster-docker-compose-scala/build.sbt b/pekko-sample-cluster-docker-compose-scala/build.sbt index 6572b67d..a84864fa 100644 --- a/pekko-sample-cluster-docker-compose-scala/build.sbt +++ b/pekko-sample-cluster-docker-compose-scala/build.sbt @@ -2,7 +2,7 @@ organization := "org.apache.pekko" name := "pekko-sample-cluster-docker-compose-scala" /* scala versions and options */ -scalaVersion := "3.3.7" +scalaVersion := "3.3.9" // These options will be used for *all* versions. scalacOptions ++= Seq( @@ -10,7 +10,7 @@ scalacOptions ++= Seq( "-unchecked", "-encoding", "UTF-8") -val pekkoVersion = "1.5.0" +val pekkoVersion = "2.0.0" val logbackVersion = "1.3.15" /* dependencies */ @@ -24,5 +24,7 @@ libraryDependencies ++= Seq( Docker / version := "latest" Docker / dockerExposedPorts := Seq(1600) dockerRepository := Some("pekko") -dockerBaseImage := "eclipse-temurin:11" +dockerBaseImage := "eclipse-temurin:17" +// Agrona (used by pekko-remote Artery) needs access to jdk.internal.misc.Unsafe +bashScriptExtraDefines += """addJava "--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED"""" enablePlugins(JavaAppPackaging) diff --git a/pekko-sample-cluster-docker-compose-scala/project/build.properties b/pekko-sample-cluster-docker-compose-scala/project/build.properties index df061f4f..36860735 100644 --- a/pekko-sample-cluster-docker-compose-scala/project/build.properties +++ b/pekko-sample-cluster-docker-compose-scala/project/build.properties @@ -1 +1 @@ -sbt.version=1.12.9 +sbt.version=1.13.1 diff --git a/pekko-sample-cluster-java/.jvmopts b/pekko-sample-cluster-java/.jvmopts new file mode 100644 index 00000000..4df36e78 --- /dev/null +++ b/pekko-sample-cluster-java/.jvmopts @@ -0,0 +1 @@ +--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED diff --git a/pekko-sample-cluster-java/.mvn/jvm.config b/pekko-sample-cluster-java/.mvn/jvm.config new file mode 100644 index 00000000..4df36e78 --- /dev/null +++ b/pekko-sample-cluster-java/.mvn/jvm.config @@ -0,0 +1 @@ +--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED diff --git a/pekko-sample-cluster-java/build.sbt b/pekko-sample-cluster-java/build.sbt index e63fe1bb..a8ac69fe 100644 --- a/pekko-sample-cluster-java/build.sbt +++ b/pekko-sample-cluster-java/build.sbt @@ -1,6 +1,6 @@ import com.typesafe.sbt.MultiJvmPlugin.multiJvmSettings -val pekkoVersion = "1.5.0" +val pekkoVersion = "2.0.0" val logbackVersion = "1.3.15" lazy val `pekko-sample-cluster-java` = project @@ -8,7 +8,9 @@ lazy val `pekko-sample-cluster-java` = project .settings(multiJvmSettings: _*) .settings( organization := "org.apache.pekko", - scalaVersion := "3.3.7", + // Agrona (used by pekko-remote Artery) needs access to jdk.internal.misc.Unsafe + MultiJvm / jvmOptions ++= Seq("--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED"), + scalaVersion := "3.3.9", Compile / scalacOptions ++= Seq("-deprecation", "-feature", "-unchecked"), Compile / javacOptions ++= Seq("-parameters", "-Xlint:unchecked", "-Xlint:deprecation"), run / javaOptions ++= Seq("-Xms128m", "-Xmx1024m", "-Djava.library.path=./target/native"), diff --git a/pekko-sample-cluster-java/pom.xml b/pekko-sample-cluster-java/pom.xml index 2ed52172..530d3040 100644 --- a/pekko-sample-cluster-java/pom.xml +++ b/pekko-sample-cluster-java/pom.xml @@ -11,8 +11,10 @@ UTF-8 - 1.5.0 + 2.0.0 3 + + --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED @@ -51,8 +53,7 @@ maven-compiler-plugin 3.8.1 - 1.8 - 1.8 + 17 true -Xlint diff --git a/pekko-sample-cluster-java/project/build.properties b/pekko-sample-cluster-java/project/build.properties index df061f4f..36860735 100644 --- a/pekko-sample-cluster-java/project/build.properties +++ b/pekko-sample-cluster-java/project/build.properties @@ -1 +1 @@ -sbt.version=1.12.9 +sbt.version=1.13.1 diff --git a/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/App.java b/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/App.java index cd30b94c..57b9845d 100644 --- a/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/App.java +++ b/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/App.java @@ -13,10 +13,9 @@ import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; -import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.List; public class App { @@ -72,7 +71,7 @@ private static void startup(String role, int port) { // Override the configuration of the port Map overrides = new HashMap<>(); overrides.put("pekko.remote.artery.canonical.port", port); - overrides.put("pekko.cluster.roles", Collections.singletonList(role)); + overrides.put("pekko.cluster.roles", List.of(role)); Config config = ConfigFactory.parseMap(overrides) .withFallback(ConfigFactory.load("stats")); diff --git a/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/AppOneMaster.java b/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/AppOneMaster.java index 77c3a3ba..91fa2862 100644 --- a/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/AppOneMaster.java +++ b/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/AppOneMaster.java @@ -16,10 +16,9 @@ import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; -import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.List; public class AppOneMaster { @@ -87,7 +86,7 @@ private static void startup(String role, int port) { // Override the configuration of the port Map overrides = new HashMap<>(); overrides.put("pekko.remote.artery.canonical.port", port); - overrides.put("pekko.cluster.roles", Collections.singletonList(role)); + overrides.put("pekko.cluster.roles", List.of(role)); Config config = ConfigFactory.parseMap(overrides) .withFallback(ConfigFactory.load("stats")); diff --git a/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/StatsService.java b/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/StatsService.java index 0aa163b6..601324d0 100644 --- a/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/StatsService.java +++ b/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/StatsService.java @@ -9,7 +9,6 @@ import com.fasterxml.jackson.annotation.JsonCreator; import sample.cluster.CborSerializable; -import java.util.Arrays; import java.util.List; public final class StatsService extends AbstractBehavior { @@ -78,7 +77,7 @@ public Receive createReceive() { private Behavior process(ProcessText command) { getContext().getLog().info("Delegating request"); - List words = Arrays.asList(command.text.split(" ")); + List words = List.of(command.text.split(" ")); getContext().spawnAnonymous(StatsAggregator.create(words, workers, command.replyTo)); return this; } diff --git a/pekko-sample-cluster-java/src/main/java/sample/cluster/transformation/App.java b/pekko-sample-cluster-java/src/main/java/sample/cluster/transformation/App.java index e4537bd9..64ba3715 100644 --- a/pekko-sample-cluster-java/src/main/java/sample/cluster/transformation/App.java +++ b/pekko-sample-cluster-java/src/main/java/sample/cluster/transformation/App.java @@ -7,10 +7,9 @@ import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; -import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.List; public class App { @@ -53,7 +52,7 @@ private static void startup(String role, int port) { // Override the configuration of the port Map overrides = new HashMap<>(); overrides.put("pekko.remote.artery.canonical.port", port); - overrides.put("pekko.cluster.roles", Collections.singletonList(role)); + overrides.put("pekko.cluster.roles", List.of(role)); Config config = ConfigFactory.parseMap(overrides) .withFallback(ConfigFactory.load("transformation")); diff --git a/pekko-sample-cluster-kubernetes-java/.mvn/jvm.config b/pekko-sample-cluster-kubernetes-java/.mvn/jvm.config new file mode 100644 index 00000000..4df36e78 --- /dev/null +++ b/pekko-sample-cluster-kubernetes-java/.mvn/jvm.config @@ -0,0 +1 @@ +--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED diff --git a/pekko-sample-cluster-kubernetes-java/pom.xml b/pekko-sample-cluster-kubernetes-java/pom.xml index 3f0e2980..2ab5bd9a 100644 --- a/pekko-sample-cluster-kubernetes-java/pom.xml +++ b/pekko-sample-cluster-kubernetes-java/pom.xml @@ -15,14 +15,15 @@ - 1.8 - 1.8 + 17 UTF-8 - 1.5.0 - 1.3.0 - 1.2.1 + 2.0.0 + 2.0.0-M2 + 2.0.0-M1 3 ${git.commit.time}-${git.commit.id.abbrev} + + --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED @@ -61,6 +62,12 @@ pekko-discovery_${scala.binary.version} ${pekko.version} + + + org.apache.pekko + pekko-pki_${scala.binary.version} + ${pekko.version} + ch.qos.logback logback-classic @@ -97,13 +104,13 @@ ${version.number} latest - adoptopenjdk:11-jre-hotspot + eclipse-temurin:17 8080 7626 - java $JAVA_OPTS -cp '/maven/*' org.apache.pekko.cluster.bootstrap.demo.DemoApp + java --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED $JAVA_OPTS -cp '/maven/*' org.apache.pekko.cluster.bootstrap.demo.DemoApp artifact-with-dependencies diff --git a/pekko-sample-cluster-kubernetes-scala/.jvmopts b/pekko-sample-cluster-kubernetes-scala/.jvmopts new file mode 100644 index 00000000..4df36e78 --- /dev/null +++ b/pekko-sample-cluster-kubernetes-scala/.jvmopts @@ -0,0 +1 @@ +--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED diff --git a/pekko-sample-cluster-kubernetes-scala/build.sbt b/pekko-sample-cluster-kubernetes-scala/build.sbt index 7f209869..d8465149 100644 --- a/pekko-sample-cluster-kubernetes-scala/build.sbt +++ b/pekko-sample-cluster-kubernetes-scala/build.sbt @@ -2,10 +2,11 @@ ThisBuild / organization := "org.apache.pekko" name := "pekko-sample-cluster-kubernetes-scala" -scalaVersion := "3.3.7" -val pekkoHttpVersion = "1.3.0" -val pekkoVersion = "1.5.0" -val pekkoManagementVersion = "1.2.1" +scalaVersion := "3.3.9" +val pekkoHttpVersion = "2.0.0-M2" +ThisBuild / evictionErrorLevel := Level.Info +val pekkoVersion = "2.0.0" +val pekkoManagementVersion = "2.0.0-M1" val logbackVersion = "1.3.15" // make version compatible with docker for publishing @@ -15,6 +16,9 @@ scalacOptions := Seq("-feature", "-unchecked", "-deprecation", "-encoding", "utf classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.AllLibraryJars run / fork := true Compile / run / fork := true +// Agrona (used by pekko-remote Artery) needs access to jdk.internal.misc.Unsafe +run / javaOptions += "--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED" +bashScriptExtraDefines += """addJava "--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED"""" Compile / run / mainClass := Some("pekko.sample.cluster.kubernetes.DemoApp") @@ -24,7 +28,7 @@ dockerExposedPorts := Seq(8080, 7626, 17355) dockerUpdateLatest := true dockerUsername := sys.props.get("docker.username") dockerRepository := sys.props.get("docker.registry") -dockerBaseImage := "adoptopenjdk:11-jre-hotspot" +dockerBaseImage := "eclipse-temurin:17" libraryDependencies ++= { Seq( diff --git a/pekko-sample-cluster-kubernetes-scala/project/build.properties b/pekko-sample-cluster-kubernetes-scala/project/build.properties index df061f4f..36860735 100644 --- a/pekko-sample-cluster-kubernetes-scala/project/build.properties +++ b/pekko-sample-cluster-kubernetes-scala/project/build.properties @@ -1 +1 @@ -sbt.version=1.12.9 +sbt.version=1.13.1 diff --git a/pekko-sample-cluster-scala/.jvmopts b/pekko-sample-cluster-scala/.jvmopts new file mode 100644 index 00000000..4df36e78 --- /dev/null +++ b/pekko-sample-cluster-scala/.jvmopts @@ -0,0 +1 @@ +--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED diff --git a/pekko-sample-cluster-scala/build.sbt b/pekko-sample-cluster-scala/build.sbt index ca9fded7..9c978d4c 100644 --- a/pekko-sample-cluster-scala/build.sbt +++ b/pekko-sample-cluster-scala/build.sbt @@ -1,6 +1,6 @@ import com.typesafe.sbt.MultiJvmPlugin.multiJvmSettings -val pekkoVersion = "1.5.0" +val pekkoVersion = "2.0.0" val logbackVersion = "1.3.15" lazy val `pekko-sample-cluster-scala` = project @@ -8,7 +8,9 @@ lazy val `pekko-sample-cluster-scala` = project .settings(multiJvmSettings: _*) .settings( organization := "org.apache.pekko", - scalaVersion := "3.3.7", + // Agrona (used by pekko-remote Artery) needs access to jdk.internal.misc.Unsafe + MultiJvm / jvmOptions ++= Seq("--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED"), + scalaVersion := "3.3.9", Compile / scalacOptions ++= Seq("-deprecation", "-feature", "-unchecked"), Compile / javacOptions ++= Seq("-Xlint:unchecked", "-Xlint:deprecation"), run / javaOptions ++= Seq("-Xms128m", "-Xmx1024m", "-Djava.library.path=./target/native"), diff --git a/pekko-sample-cluster-scala/project/build.properties b/pekko-sample-cluster-scala/project/build.properties index df061f4f..36860735 100644 --- a/pekko-sample-cluster-scala/project/build.properties +++ b/pekko-sample-cluster-scala/project/build.properties @@ -1 +1 @@ -sbt.version=1.12.9 +sbt.version=1.13.1 diff --git a/pekko-sample-distributed-data-java/.jvmopts b/pekko-sample-distributed-data-java/.jvmopts new file mode 100644 index 00000000..4df36e78 --- /dev/null +++ b/pekko-sample-distributed-data-java/.jvmopts @@ -0,0 +1 @@ +--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED diff --git a/pekko-sample-distributed-data-java/build.sbt b/pekko-sample-distributed-data-java/build.sbt index d339b733..bcfb59dc 100644 --- a/pekko-sample-distributed-data-java/build.sbt +++ b/pekko-sample-distributed-data-java/build.sbt @@ -1,6 +1,6 @@ import com.typesafe.sbt.MultiJvmPlugin.multiJvmSettings -val pekkoVersion = "1.5.0" +val pekkoVersion = "2.0.0" val logbackVersion = "1.3.15" val `pekko-sample-distributed-data-java` = project @@ -8,11 +8,13 @@ val `pekko-sample-distributed-data-java` = project .settings(multiJvmSettings: _*) .settings( organization := "org.apache.pekko", + // Agrona (used by pekko-remote Artery) needs access to jdk.internal.misc.Unsafe + MultiJvm / jvmOptions ++= Seq("--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED"), version := "1.0", - scalaVersion := "3.3.7", + scalaVersion := "3.3.9", Compile / scalacOptions ++= Seq("-deprecation", "-feature", "-unchecked"), Compile / javacOptions ++= Seq("-parameters", "-Xlint:unchecked", "-Xlint:deprecation", "-Xdiags:verbose"), - run / javaOptions ++= Seq("-Xms128m", "-Xmx1024m"), + run / javaOptions ++= Seq("-Xms128m", "-Xmx1024m", "--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED"), libraryDependencies ++= Seq( "org.apache.pekko" %% "pekko-cluster-typed" % pekkoVersion, "org.apache.pekko" %% "pekko-serialization-jackson" % pekkoVersion, diff --git a/pekko-sample-distributed-data-java/project/build.properties b/pekko-sample-distributed-data-java/project/build.properties index df061f4f..36860735 100644 --- a/pekko-sample-distributed-data-java/project/build.properties +++ b/pekko-sample-distributed-data-java/project/build.properties @@ -1 +1 @@ -sbt.version=1.12.9 +sbt.version=1.13.1 diff --git a/pekko-sample-distributed-data-java/src/main/java/sample/distributeddata/ReplicatedCache.java b/pekko-sample-distributed-data-java/src/main/java/sample/distributeddata/ReplicatedCache.java index 9b29108d..c985bf85 100644 --- a/pekko-sample-distributed-data-java/src/main/java/sample/distributeddata/ReplicatedCache.java +++ b/pekko-sample-distributed-data-java/src/main/java/sample/distributeddata/ReplicatedCache.java @@ -194,8 +194,8 @@ private Behavior receiveGetFromCache(String key, ActorRef reply } private Behavior onInternalGetResponse(InternalGetResponse msg) { - if (msg.rsp instanceof GetSuccess) { - Option valueOption = ((GetSuccess>) msg.rsp).get(dataKey(msg.key)).get(msg.key); + if (msg.rsp instanceof GetSuccess> success) { + Option valueOption = success.get(dataKey(msg.key)).get(msg.key); Optional valueOptional = Optional.ofNullable(valueOption.isDefined() ? valueOption.get() : null); msg.replyTo.tell(new Cached(msg.key, valueOptional)); } else if (msg.rsp instanceof NotFound) { diff --git a/pekko-sample-distributed-data-java/src/main/java/sample/distributeddata/ReplicatedMetrics.java b/pekko-sample-distributed-data-java/src/main/java/sample/distributeddata/ReplicatedMetrics.java index 44c385d4..e467ecc2 100644 --- a/pekko-sample-distributed-data-java/src/main/java/sample/distributeddata/ReplicatedMetrics.java +++ b/pekko-sample-distributed-data-java/src/main/java/sample/distributeddata/ReplicatedMetrics.java @@ -177,10 +177,10 @@ private Behavior receiveTick() { private Behavior onInternalSubscribeResponse(InternalSubscribeResponse rsp) { SubscribeResponse> rsp1 = rsp.rsp; - if (rsp1 instanceof Changed && rsp1.key().equals(maxHeapKey)) { - receiveMaxHeapChanged((Changed>) rsp1); - } else if (rsp1 instanceof Changed && rsp1.key().equals(usedHeapKey)) { - receiveUsedHeapChanged((Changed>) rsp1); + if (rsp1 instanceof Changed> changed && changed.key().equals(maxHeapKey)) { + receiveMaxHeapChanged(changed); + } else if (rsp1 instanceof Changed> changed && changed.key().equals(usedHeapKey)) { + receiveUsedHeapChanged(changed); } return this; } @@ -217,7 +217,7 @@ private Behavior receiveMemberRemoved(Address address) { private Behavior receiveCleanup() { // note that this function is run in the replicator, so we cannot safely reference // mutable internal state of this actor, we therefore make a defensive copy here - final Set nodesAtCleanup = Collections.unmodifiableSet(new HashSet<>(nodesInCluster)); + final Set nodesAtCleanup = Set.copyOf(nodesInCluster); Function, LWWMap> cleanupRemoved = (data) -> { LWWMap result = data; for (String k : data.getEntries().keySet()) { diff --git a/pekko-sample-distributed-data-java/src/main/java/sample/distributeddata/ShoppingCart.java b/pekko-sample-distributed-data-java/src/main/java/sample/distributeddata/ShoppingCart.java index ed1fcf98..6d8a1f05 100644 --- a/pekko-sample-distributed-data-java/src/main/java/sample/distributeddata/ShoppingCart.java +++ b/pekko-sample-distributed-data-java/src/main/java/sample/distributeddata/ShoppingCart.java @@ -199,8 +199,8 @@ private Behavior onGetCart(GetCart command) { } private Behavior onInternalGetResponse(InternalGetResponse msg) { - if (msg.rsp instanceof GetSuccess) { - LWWMap data = ((GetSuccess>) msg.rsp).get(dataKey); + if (msg.rsp instanceof GetSuccess> success) { + LWWMap data = success.get(dataKey); msg.replyTo.tell(new Cart(new HashSet<>(data.getEntries().values()))); } else if (msg.rsp instanceof NotFound) { msg.replyTo.tell(new Cart(new HashSet<>())); diff --git a/pekko-sample-distributed-data-java/src/main/java/sample/distributeddata/VotingService.java b/pekko-sample-distributed-data-java/src/main/java/sample/distributeddata/VotingService.java index 30d01b26..1ab48069 100644 --- a/pekko-sample-distributed-data-java/src/main/java/sample/distributeddata/VotingService.java +++ b/pekko-sample-distributed-data-java/src/main/java/sample/distributeddata/VotingService.java @@ -171,12 +171,12 @@ private Behavior receiveClose() { } private Behavior onInternalSubscribeResponse(InternalSubscribeResponse rsp) { - if (rsp.rsp instanceof Changed && rsp.rsp.key().equals(openedKey)) { - if (((Changed) rsp.rsp).dataValue().enabled()) { + if (rsp.rsp instanceof Changed changed && changed.key().equals(openedKey)) { + if (changed.dataValue().enabled()) { return becomeOpen(); } - } else if (rsp.rsp instanceof Changed && rsp.rsp.key().equals(closedKey)) { - if (((Changed) rsp.rsp).dataValue().enabled()) { + } else if (rsp.rsp instanceof Changed changed && changed.key().equals(closedKey)) { + if (changed.dataValue().enabled()) { return matchGetVotes(false); } } @@ -204,9 +204,8 @@ private Behavior receiveGetVotes(GetVotes getVotes) { } private Behavior onInternalGetResponse(boolean open, InternalGetResponse rsp) { - if (rsp.rsp instanceof GetSuccess && rsp.rsp.key().equals(countersKey)) { - GetSuccess> rsp1 = (GetSuccess>) rsp.rsp; - Map result = rsp1.dataValue().getEntries(); + if (rsp.rsp instanceof GetSuccess> success && success.key().equals(countersKey)) { + Map result = success.dataValue().getEntries(); rsp.replyTo.tell(new Votes(result, open)); } else if (rsp.rsp instanceof NotFound && rsp.rsp.key().equals(countersKey)) { rsp.replyTo.tell(new Votes(new HashMap<>(), open)); diff --git a/pekko-sample-distributed-data-java/src/multi-jvm/scala/sample/distributeddata/ReplicatedMetricsSpec.scala b/pekko-sample-distributed-data-java/src/multi-jvm/scala/sample/distributeddata/ReplicatedMetricsSpec.scala index 6cb549e3..75c71056 100644 --- a/pekko-sample-distributed-data-java/src/multi-jvm/scala/sample/distributeddata/ReplicatedMetricsSpec.scala +++ b/pekko-sample-distributed-data-java/src/multi-jvm/scala/sample/distributeddata/ReplicatedMetricsSpec.scala @@ -1,7 +1,7 @@ package sample.distributeddata import java.time.Duration -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import scala.concurrent.duration._ import org.apache.pekko.actor.testkit.typed.scaladsl.TestProbe import org.apache.pekko.actor.typed.ActorSystem diff --git a/pekko-sample-distributed-data-java/src/multi-jvm/scala/sample/distributeddata/ShoppingCartSpec.scala b/pekko-sample-distributed-data-java/src/multi-jvm/scala/sample/distributeddata/ShoppingCartSpec.scala index 7eac75ce..99eb9f7c 100644 --- a/pekko-sample-distributed-data-java/src/multi-jvm/scala/sample/distributeddata/ShoppingCartSpec.scala +++ b/pekko-sample-distributed-data-java/src/multi-jvm/scala/sample/distributeddata/ShoppingCartSpec.scala @@ -13,7 +13,7 @@ import org.apache.pekko.remote.testconductor.RoleName import org.apache.pekko.remote.testkit.MultiNodeConfig import org.apache.pekko.remote.testkit.MultiNodeSpec import com.typesafe.config.ConfigFactory -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ object ShoppingCartSpec extends MultiNodeConfig { val node1 = role("node-1") diff --git a/pekko-sample-distributed-data-java/src/multi-jvm/scala/sample/distributeddata/VotingServiceSpec.scala b/pekko-sample-distributed-data-java/src/multi-jvm/scala/sample/distributeddata/VotingServiceSpec.scala index ee321e28..bda3bc1b 100644 --- a/pekko-sample-distributed-data-java/src/multi-jvm/scala/sample/distributeddata/VotingServiceSpec.scala +++ b/pekko-sample-distributed-data-java/src/multi-jvm/scala/sample/distributeddata/VotingServiceSpec.scala @@ -93,7 +93,7 @@ class VotingServiceSpec extends MultiNodeSpec(VotingServiceSpec) with STMultiNod votingService ! new GetVotes(p.ref) val votes = p.expectMessageType[Votes](3.seconds) votes.open should be(false) - import scala.collection.JavaConverters._ + import scala.jdk.CollectionConverters._ votes.result.asScala.toMap should be(expected) } diff --git a/pekko-sample-distributed-data-scala/.jvmopts b/pekko-sample-distributed-data-scala/.jvmopts new file mode 100644 index 00000000..4df36e78 --- /dev/null +++ b/pekko-sample-distributed-data-scala/.jvmopts @@ -0,0 +1 @@ +--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED diff --git a/pekko-sample-distributed-data-scala/build.sbt b/pekko-sample-distributed-data-scala/build.sbt index ca8e2efa..a307e5d1 100644 --- a/pekko-sample-distributed-data-scala/build.sbt +++ b/pekko-sample-distributed-data-scala/build.sbt @@ -1,6 +1,6 @@ import com.typesafe.sbt.MultiJvmPlugin.multiJvmSettings -val pekkoVersion = "1.5.0" +val pekkoVersion = "2.0.0" val logbackVersion = "1.3.15" val `pekko-sample-distributed-data-scala` = project @@ -8,11 +8,13 @@ val `pekko-sample-distributed-data-scala` = project .settings(multiJvmSettings: _*) .settings( organization := "org.apache.pekko", + // Agrona (used by pekko-remote Artery) needs access to jdk.internal.misc.Unsafe + MultiJvm / jvmOptions ++= Seq("--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED"), version := "1.0", - scalaVersion := "3.3.7", + scalaVersion := "3.3.9", Compile / scalacOptions ++= Seq("-deprecation", "-feature", "-unchecked"), Compile / javacOptions ++= Seq("-Xlint:unchecked", "-Xlint:deprecation"), - run / javaOptions ++= Seq("-Xms128m", "-Xmx1024m"), + run / javaOptions ++= Seq("-Xms128m", "-Xmx1024m", "--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED"), libraryDependencies ++= Seq( "org.apache.pekko" %% "pekko-cluster-typed" % pekkoVersion, "org.apache.pekko" %% "pekko-serialization-jackson" % pekkoVersion, diff --git a/pekko-sample-distributed-data-scala/project/build.properties b/pekko-sample-distributed-data-scala/project/build.properties index df061f4f..36860735 100644 --- a/pekko-sample-distributed-data-scala/project/build.properties +++ b/pekko-sample-distributed-data-scala/project/build.properties @@ -1 +1 @@ -sbt.version=1.12.9 +sbt.version=1.13.1 diff --git a/pekko-sample-distributed-workers-scala/.jvmopts b/pekko-sample-distributed-workers-scala/.jvmopts new file mode 100644 index 00000000..4df36e78 --- /dev/null +++ b/pekko-sample-distributed-workers-scala/.jvmopts @@ -0,0 +1 @@ +--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED diff --git a/pekko-sample-distributed-workers-scala/build.sbt b/pekko-sample-distributed-workers-scala/build.sbt index 26a3b3d9..a048dbb7 100644 --- a/pekko-sample-distributed-workers-scala/build.sbt +++ b/pekko-sample-distributed-workers-scala/build.sbt @@ -2,9 +2,10 @@ name := "pekko-distributed-workers-scala" version := "1.0" -scalaVersion := "3.3.7" +scalaVersion := "3.3.9" -val pekkoVersion = "1.5.0" +ThisBuild / evictionErrorLevel := Level.Info +val pekkoVersion = "2.0.0" val cassandraPluginVersion = "1.1.0" val logbackVersion = "1.3.15" diff --git a/pekko-sample-distributed-workers-scala/project/build.properties b/pekko-sample-distributed-workers-scala/project/build.properties index df061f4f..36860735 100644 --- a/pekko-sample-distributed-workers-scala/project/build.properties +++ b/pekko-sample-distributed-workers-scala/project/build.properties @@ -1 +1 @@ -sbt.version=1.12.9 +sbt.version=1.13.1 diff --git a/pekko-sample-fsm-java/pom.xml b/pekko-sample-fsm-java/pom.xml index 299f69bf..09241547 100644 --- a/pekko-sample-fsm-java/pom.xml +++ b/pekko-sample-fsm-java/pom.xml @@ -6,7 +6,7 @@ UTF-8 - 1.5.0 + 2.0.0 3 @@ -35,8 +35,7 @@ maven-compiler-plugin 3.8.1 - 1.8 - 1.8 + 17 true -Xlint diff --git a/pekko-sample-fsm-java/src/main/java/sample/DiningHakkers.java b/pekko-sample-fsm-java/src/main/java/sample/DiningHakkers.java index 42631d97..b9f53b36 100644 --- a/pekko-sample-fsm-java/src/main/java/sample/DiningHakkers.java +++ b/pekko-sample-fsm-java/src/main/java/sample/DiningHakkers.java @@ -7,9 +7,7 @@ import org.apache.pekko.actor.typed.javadsl.Behaviors; import org.apache.pekko.actor.typed.javadsl.ActorContext; -import java.util.Arrays; import java.util.List; -import java.util.stream.Collectors; import java.util.stream.IntStream; public class DiningHakkers { @@ -32,10 +30,10 @@ private Behavior behavior() { //Create 5 chopsticks List> chopsticks = IntStream.rangeClosed(1, 5) .mapToObj(i -> context.spawn(Chopstick.create(), "Chopstick" + i)) - .collect(Collectors.toList()); + .toList(); //Create 5 hakkers and assign them their left and right chopstick - List names = Arrays.asList("Ghosh", "Boner", "Klang", "Krasser", "Manie"); + List names = List.of("Ghosh", "Boner", "Klang", "Krasser", "Manie"); IntStream.range(0, names.size()) .mapToObj(i -> context.spawn(Hakker.create(names.get(i), chopsticks.get(i), chopsticks.get((i + 1) % 5)), names.get(i)) diff --git a/pekko-sample-fsm-scala/build.sbt b/pekko-sample-fsm-scala/build.sbt index ba65fa0e..79b792dd 100644 --- a/pekko-sample-fsm-scala/build.sbt +++ b/pekko-sample-fsm-scala/build.sbt @@ -1,10 +1,10 @@ organization := "org.apache.pekko" name := "pekko-sample-fsm-scala" -val pekkoVersion = "1.5.0" +val pekkoVersion = "2.0.0" val logbackVersion = "1.3.15" -scalaVersion := "3.3.7" +scalaVersion := "3.3.9" libraryDependencies ++= Seq( "org.apache.pekko" %% "pekko-actor-typed" % pekkoVersion, "ch.qos.logback" % "logback-classic" % logbackVersion) diff --git a/pekko-sample-fsm-scala/project/build.properties b/pekko-sample-fsm-scala/project/build.properties index df061f4f..36860735 100644 --- a/pekko-sample-fsm-scala/project/build.properties +++ b/pekko-sample-fsm-scala/project/build.properties @@ -1 +1 @@ -sbt.version=1.12.9 +sbt.version=1.13.1 diff --git a/pekko-sample-grpc-kubernetes-scala/build.sbt b/pekko-sample-grpc-kubernetes-scala/build.sbt index dc165c1b..ceef1a8b 100644 --- a/pekko-sample-grpc-kubernetes-scala/build.sbt +++ b/pekko-sample-grpc-kubernetes-scala/build.sbt @@ -1,9 +1,10 @@ name := "pekko-grpc-kubernetes" -scalaVersion := "3.3.7" +ThisBuild / scalaVersion := "3.3.9" -lazy val pekkoVersion = "1.5.0" -lazy val pekkoManagementVersion = "1.2.1" -lazy val pekkoHttpVersion = "1.3.0" +ThisBuild / evictionErrorLevel := Level.Info +lazy val pekkoVersion = "2.0.0" +lazy val pekkoManagementVersion = "2.0.0-M1" +lazy val pekkoHttpVersion = "2.0.0-M2" lazy val root = (project in file(".")) .aggregate(httpToGrpc, grpcService) diff --git a/pekko-sample-grpc-kubernetes-scala/project/build.properties b/pekko-sample-grpc-kubernetes-scala/project/build.properties index df061f4f..36860735 100644 --- a/pekko-sample-grpc-kubernetes-scala/project/build.properties +++ b/pekko-sample-grpc-kubernetes-scala/project/build.properties @@ -1 +1 @@ -sbt.version=1.12.9 +sbt.version=1.13.1 diff --git a/pekko-sample-grpc-kubernetes-scala/project/plugins.sbt b/pekko-sample-grpc-kubernetes-scala/project/plugins.sbt index 61688eef..0545d6ff 100644 --- a/pekko-sample-grpc-kubernetes-scala/project/plugins.sbt +++ b/pekko-sample-grpc-kubernetes-scala/project/plugins.sbt @@ -1,4 +1,4 @@ dependencyOverrides += "org.scala-lang.modules" %% "scala-xml" % "2.2.0" -addSbtPlugin("org.apache.pekko" % "pekko-grpc-sbt-plugin" % "1.2.0") +addSbtPlugin("org.apache.pekko" % "pekko-grpc-sbt-plugin" % "2.0.0-M2") addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.0") diff --git a/pekko-sample-kafka-to-sharding-scala/.jvmopts b/pekko-sample-kafka-to-sharding-scala/.jvmopts new file mode 100644 index 00000000..4df36e78 --- /dev/null +++ b/pekko-sample-kafka-to-sharding-scala/.jvmopts @@ -0,0 +1 @@ +--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED diff --git a/pekko-sample-kafka-to-sharding-scala/build.sbt b/pekko-sample-kafka-to-sharding-scala/build.sbt index 4353e02f..dfca45aa 100644 --- a/pekko-sample-kafka-to-sharding-scala/build.sbt +++ b/pekko-sample-kafka-to-sharding-scala/build.sbt @@ -1,13 +1,14 @@ -val pekkoVersion = "1.5.0" -val pekkoHttpVersion = "1.3.0" +ThisBuild / evictionErrorLevel := Level.Info +val pekkoVersion = "2.0.0" +val pekkoHttpVersion = "2.0.0-M2" -val pekkoConnectorsKafkaVersion = "1.1.0" -val pekkoManagementVersion = "1.2.1" +val pekkoConnectorsKafkaVersion = "2.0.0-M1" +val pekkoManagementVersion = "2.0.0-M1" val EmbeddedKafkaVersion = "2.4.1.1" val logbackVersion = "1.3.15" val slf4jVersion = "2.0.17" -ThisBuild / scalaVersion := "3.3.7" +ThisBuild / scalaVersion := "3.3.9" ThisBuild / organization := "org.apache.pekko" ThisBuild / Compile / scalacOptions ++= Seq( "-deprecation", @@ -42,6 +43,8 @@ lazy val processor = project .in(file("processor")) .enablePlugins(PekkoGrpcPlugin, JavaAgent) .settings(javaAgents += "org.mortbay.jetty.alpn" % "jetty-alpn-agent" % "2.0.10" % "runtime;test") + // Agrona (used by pekko-remote Artery) needs access to jdk.internal.misc.Unsafe + .settings(javaOptions += "--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED") .settings(libraryDependencies ++= Seq( "org.apache.pekko" %% "pekko-connectors-kafka" % pekkoConnectorsKafkaVersion, "org.apache.pekko" %% "pekko-connectors-kafka-cluster-sharding" % pekkoConnectorsKafkaVersion, diff --git a/pekko-sample-kafka-to-sharding-scala/processor/src/main/scala/sample/sharding/kafka/Main.scala b/pekko-sample-kafka-to-sharding-scala/processor/src/main/scala/sample/sharding/kafka/Main.scala index 027fcf3b..44ed6ca1 100644 --- a/pekko-sample-kafka-to-sharding-scala/processor/src/main/scala/sample/sharding/kafka/Main.scala +++ b/pekko-sample-kafka-to-sharding-scala/processor/src/main/scala/sample/sharding/kafka/Main.scala @@ -7,7 +7,6 @@ import org.apache.pekko.cluster.typed.{ Cluster, SelfUp, Subscribe } import org.apache.pekko.http.scaladsl._ import org.apache.pekko.http.scaladsl.model.{ HttpRequest, HttpResponse } import org.apache.pekko.management.scaladsl.PekkoManagement -import org.apache.pekko.stream.Materializer import com.typesafe.config.{ Config, ConfigFactory } import scala.concurrent.Future @@ -96,14 +95,9 @@ object Main { def startGrpc( system: ActorSystem[?], frontEndPort: Int, region: ActorRef[UserEvents.Command]): Future[Http.ServerBinding] = { - val mat = Materializer.createMaterializer(system.toClassic) val service: HttpRequest => Future[HttpResponse] = UserServiceHandler(new UserGrpcService(system, region))(system.toClassic) - Http()(system.toClassic).bindAndHandleAsync( - service, - interface = "127.0.0.1", - port = frontEndPort, - connectionContext = HttpConnectionContext())(mat) + Http()(system.toClassic).newServerAt("127.0.0.1", frontEndPort).bind(service) } diff --git a/pekko-sample-kafka-to-sharding-scala/project/build.properties b/pekko-sample-kafka-to-sharding-scala/project/build.properties index df061f4f..36860735 100644 --- a/pekko-sample-kafka-to-sharding-scala/project/build.properties +++ b/pekko-sample-kafka-to-sharding-scala/project/build.properties @@ -1 +1 @@ -sbt.version=1.12.9 +sbt.version=1.13.1 diff --git a/pekko-sample-kafka-to-sharding-scala/project/plugins.sbt b/pekko-sample-kafka-to-sharding-scala/project/plugins.sbt index 81e1d48d..8bfdca86 100644 --- a/pekko-sample-kafka-to-sharding-scala/project/plugins.sbt +++ b/pekko-sample-kafka-to-sharding-scala/project/plugins.sbt @@ -1,6 +1,6 @@ -addSbtPlugin("org.apache.pekko" % "pekko-grpc-sbt-plugin" % "1.2.0") +addSbtPlugin("org.apache.pekko" % "pekko-grpc-sbt-plugin" % "2.0.0-M2") addSbtPlugin("com.github.sbt" % "sbt-javaagent" % "0.2.0") // ALPN agent addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.8") -libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.11.20" +libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "1.0.0-alpha.5" diff --git a/pekko-sample-persistence-dc-java/.mvn/jvm.config b/pekko-sample-persistence-dc-java/.mvn/jvm.config new file mode 100644 index 00000000..4df36e78 --- /dev/null +++ b/pekko-sample-persistence-dc-java/.mvn/jvm.config @@ -0,0 +1 @@ +--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED diff --git a/pekko-sample-persistence-dc-java/pom.xml b/pekko-sample-persistence-dc-java/pom.xml index 54f36ff9..64343262 100644 --- a/pekko-sample-persistence-dc-java/pom.xml +++ b/pekko-sample-persistence-dc-java/pom.xml @@ -18,11 +18,13 @@ UTF-8 - 1.5.0 + 2.0.0 1.1.0 - 1.3.0 - 1.2.1 + 2.0.0-M2 + 2.0.0-M1 3 + + --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED @@ -117,8 +119,7 @@ maven-compiler-plugin 3.8.1 - 1.8 - 1.8 + 17 -Xlint:unchecked -Xlint:deprecation diff --git a/pekko-sample-persistence-dc-java/src/main/java/sample/persistence/res/MainApp.java b/pekko-sample-persistence-dc-java/src/main/java/sample/persistence/res/MainApp.java index 22f2deb0..dbb424e5 100644 --- a/pekko-sample-persistence-dc-java/src/main/java/sample/persistence/res/MainApp.java +++ b/pekko-sample-persistence-dc-java/src/main/java/sample/persistence/res/MainApp.java @@ -1,9 +1,7 @@ package sample.persistence.res; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; import java.util.Set; +import java.util.List; import java.util.concurrent.CountDownLatch; import org.apache.pekko.actor.typed.ActorSystem; @@ -24,7 +22,7 @@ public class MainApp { public static Set ALL_REPLICAS = - Collections.unmodifiableSet(new HashSet<>(Arrays.asList(new ReplicaId("eu-west"), new ReplicaId("eu-central")))); + Set.of(new ReplicaId("eu-west"), new ReplicaId("eu-central")); public static void main(String[] args) { if (args.length == 0) { @@ -84,7 +82,7 @@ private static void startCassandraDatabase() { final CassandraContainer container = new CassandraContainer( DockerImageName.parse("cassandra:5.0.5")); // bind to the fixed port 9042 so that the sample nodes can connect with the default driver settings - container.setPortBindings(java.util.Collections.singletonList("9042:9042")); + container.setPortBindings(List.of("9042:9042")); container.start(); // shut the cassandra instance down when the JVM stops diff --git a/pekko-sample-persistence-dc-java/src/main/java/sample/persistence/res/auction/AuctionEntity.java b/pekko-sample-persistence-dc-java/src/main/java/sample/persistence/res/auction/AuctionEntity.java index bc032fae..dcdbac58 100644 --- a/pekko-sample-persistence-dc-java/src/main/java/sample/persistence/res/auction/AuctionEntity.java +++ b/pekko-sample-persistence-dc-java/src/main/java/sample/persistence/res/auction/AuctionEntity.java @@ -15,7 +15,6 @@ import java.time.Duration; import java.time.Instant; -import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Set; @@ -28,7 +27,7 @@ public class AuctionEntity public static ReplicaId R1 = new ReplicaId("R1"); public static ReplicaId R2 = new ReplicaId("R2"); - public static Set ALL_REPLICAS = new HashSet<>(Arrays.asList(R1, R2)); + public static Set ALL_REPLICAS = Set.of(R1, R2); private final ActorContext context; private final TimerScheduler timers; @@ -172,7 +171,7 @@ AuctionState addFinishedAtReplica(String replica) { } public AuctionState close() { - return new AuctionState(false, highestBid, highestCounterOffer, Collections.emptySet()); + return new AuctionState(false, highestBid, highestCounterOffer, Set.of()); } public boolean isClosed() { @@ -221,7 +220,7 @@ private AuctionEntity( @Override public AuctionState emptyState() { - return new AuctionState(true, initialBid, initialBid.offer, Collections.emptySet()); + return new AuctionState(true, initialBid, initialBid.offer, Set.of()); } @Override diff --git a/pekko-sample-persistence-dc-scala/.jvmopts b/pekko-sample-persistence-dc-scala/.jvmopts new file mode 100644 index 00000000..4df36e78 --- /dev/null +++ b/pekko-sample-persistence-dc-scala/.jvmopts @@ -0,0 +1 @@ +--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED diff --git a/pekko-sample-persistence-dc-scala/build.sbt b/pekko-sample-persistence-dc-scala/build.sbt index fe704cc6..4027be61 100644 --- a/pekko-sample-persistence-dc-scala/build.sbt +++ b/pekko-sample-persistence-dc-scala/build.sbt @@ -1,13 +1,14 @@ organization := "org.apache.pekko" name := "pekko-sample-replicated-event-sourcing-scala" -scalaVersion := "3.3.7" +scalaVersion := "3.3.9" -val pekkoVersion = "1.5.0" +ThisBuild / evictionErrorLevel := Level.Info +val pekkoVersion = "2.0.0" val cassandraPluginVersion = "1.1.0" -val pekkoHttpVersion = "1.3.0" -val pekkoClusterManagementVersion = "1.2.1" +val pekkoHttpVersion = "2.0.0-M2" +val pekkoClusterManagementVersion = "2.0.0-M1" val logbackVersion = "1.3.15" diff --git a/pekko-sample-persistence-dc-scala/project/build.properties b/pekko-sample-persistence-dc-scala/project/build.properties index df061f4f..36860735 100644 --- a/pekko-sample-persistence-dc-scala/project/build.properties +++ b/pekko-sample-persistence-dc-scala/project/build.properties @@ -1 +1 @@ -sbt.version=1.12.9 +sbt.version=1.13.1 diff --git a/pekko-sample-persistence-java/pom.xml b/pekko-sample-persistence-java/pom.xml index f3e11cf7..e81174d5 100644 --- a/pekko-sample-persistence-java/pom.xml +++ b/pekko-sample-persistence-java/pom.xml @@ -18,7 +18,7 @@ UTF-8 - 1.5.0 + 2.0.0 3 @@ -62,8 +62,7 @@ maven-compiler-plugin 3.6.1 - 1.8 - 1.8 + 17 -Xlint:unchecked -Xlint:deprecation diff --git a/pekko-sample-persistence-java/src/main/java/sample/persistence/ShoppingCart.java b/pekko-sample-persistence-java/src/main/java/sample/persistence/ShoppingCart.java index 261f6ffb..58c38061 100644 --- a/pekko-sample-persistence-java/src/main/java/sample/persistence/ShoppingCart.java +++ b/pekko-sample-persistence-java/src/main/java/sample/persistence/ShoppingCart.java @@ -15,7 +15,6 @@ import java.time.Duration; import java.time.Instant; -import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Optional; @@ -177,7 +176,7 @@ public static final class Summary implements CborSerializable { public Summary(Map items, boolean checkedOut) { // Summary is included in messages and should therefore be immutable - this.items = Collections.unmodifiableMap(new HashMap<>(items)); + this.items = Map.copyOf(items); this.checkedOut = checkedOut; } } diff --git a/pekko-sample-persistence-scala/build.sbt b/pekko-sample-persistence-scala/build.sbt index 6cc8b478..56f2c055 100644 --- a/pekko-sample-persistence-scala/build.sbt +++ b/pekko-sample-persistence-scala/build.sbt @@ -1,9 +1,9 @@ organization := "org.apache.pekko" name := "pekko-sample-persistence-scala" -scalaVersion := "3.3.7" +scalaVersion := "3.3.9" -val pekkoVersion = "1.5.0" +val pekkoVersion = "2.0.0" val logbackVersion = "1.3.15" libraryDependencies ++= Seq( diff --git a/pekko-sample-persistence-scala/project/build.properties b/pekko-sample-persistence-scala/project/build.properties index df061f4f..36860735 100644 --- a/pekko-sample-persistence-scala/project/build.properties +++ b/pekko-sample-persistence-scala/project/build.properties @@ -1 +1 @@ -sbt.version=1.12.9 +sbt.version=1.13.1 diff --git a/pekko-sample-sharding-java/.jvmopts b/pekko-sample-sharding-java/.jvmopts new file mode 100644 index 00000000..4df36e78 --- /dev/null +++ b/pekko-sample-sharding-java/.jvmopts @@ -0,0 +1 @@ +--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED diff --git a/pekko-sample-sharding-java/.mvn/jvm.config b/pekko-sample-sharding-java/.mvn/jvm.config new file mode 100644 index 00000000..4df36e78 --- /dev/null +++ b/pekko-sample-sharding-java/.mvn/jvm.config @@ -0,0 +1 @@ +--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED diff --git a/pekko-sample-sharding-java/build.sbt b/pekko-sample-sharding-java/build.sbt index 335042a3..33bfe00a 100644 --- a/pekko-sample-sharding-java/build.sbt +++ b/pekko-sample-sharding-java/build.sbt @@ -1,10 +1,11 @@ -val pekkoVersion = "1.5.0" -val pekkoHttpVersion = "1.3.0" +ThisBuild / evictionErrorLevel := Level.Info +val pekkoVersion = "2.0.0" +val pekkoHttpVersion = "2.0.0-M2" val logbackVersion = "1.3.15" lazy val buildSettings = Seq( organization := "org.apache.pekko", - scalaVersion := "3.3.7") + scalaVersion := "3.3.9") lazy val commonJavacOptions = Seq( "-Xlint:unchecked", diff --git a/pekko-sample-sharding-java/killrweather-fog/pom.xml b/pekko-sample-sharding-java/killrweather-fog/pom.xml index afcfb8d1..5e978d17 100644 --- a/pekko-sample-sharding-java/killrweather-fog/pom.xml +++ b/pekko-sample-sharding-java/killrweather-fog/pom.xml @@ -18,8 +18,8 @@ UTF-8 - 1.5.0 - 1.3.0 + 2.0.0 + 2.0.0-M2 3 @@ -76,8 +76,7 @@ maven-compiler-plugin 3.8.1 - 1.8 - 1.8 + 17 -Xlint:unchecked -Xlint:deprecation diff --git a/pekko-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Fog.java b/pekko-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Fog.java index 8e76b3ef..5d9ae05a 100644 --- a/pekko-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Fog.java +++ b/pekko-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Fog.java @@ -4,7 +4,6 @@ import java.util.Arrays; import java.util.List; -import java.util.stream.Collectors; /** * In another terminal start the `Fog` (see Fog computing https://en.wikipedia.org/wiki/Fog_computing). @@ -16,9 +15,9 @@ public class Fog { public static void main(String[] args) { final List weatherApiPorts; if (args.length == 0) { - weatherApiPorts = Arrays.asList(12553, 12554); + weatherApiPorts = List.of(12553, 12554); } else { - weatherApiPorts = Arrays.asList(args).stream().map(arg -> Integer.parseInt(arg)).collect(Collectors.toList()); + weatherApiPorts = Arrays.stream(args).map(Integer::parseInt).toList(); } ActorSystem.create(Guardian.create(weatherApiPorts), "Fog"); diff --git a/pekko-sample-sharding-java/killrweather/pom.xml b/pekko-sample-sharding-java/killrweather/pom.xml index ad693442..9bfe63c5 100644 --- a/pekko-sample-sharding-java/killrweather/pom.xml +++ b/pekko-sample-sharding-java/killrweather/pom.xml @@ -18,9 +18,11 @@ UTF-8 - 1.5.0 - 1.3.0 + 2.0.0 + 2.0.0-M2 3 + + --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED @@ -80,8 +82,7 @@ maven-compiler-plugin 3.8.1 - 1.8 - 1.8 + 17 -Xlint:unchecked -Xlint:deprecation diff --git a/pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/KillrWeather.java b/pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/KillrWeather.java index 9e930b65..36948362 100644 --- a/pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/KillrWeather.java +++ b/pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/KillrWeather.java @@ -9,7 +9,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.stream.Collectors; /** * Main entry point for the application. @@ -23,7 +22,7 @@ public static void main(String[] args) throws Exception { .stream() .map(AddressFromURIString::parse) .map(addr -> (Integer) addr.port().get()) // Missing Java getter for port - .collect(Collectors.toList()); + .toList(); // Either use a single port provided by the user // Or start each listed seed nodes port plus one node on a random port in this single JVM if the user @@ -31,7 +30,7 @@ public static void main(String[] args) throws Exception { // In a production application you wouldn't start multiple ActorSystem instances in the // same JVM, here we do it to simplify running a sample cluster from a single main method. List ports = Arrays.stream(args).findFirst().map(str -> - Collections.singletonList(Integer.parseInt(str)) + List.of(Integer.parseInt(str)) ).orElseGet(() -> { List portsAndZero = new ArrayList<>(seedNodePorts); portsAndZero.add(0); diff --git a/pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherStation.java b/pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherStation.java index 015d8a48..8952e328 100644 --- a/pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherStation.java +++ b/pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherStation.java @@ -15,7 +15,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.*; -import java.util.stream.Collectors; /** * A sharded `WeatherStation` has a set of recorded datapoints @@ -180,7 +179,7 @@ private Behavior onRecord(Record record) { List dataForSameType = values.stream() .filter(d -> d.dataType == record.data.dataType) .map(d -> d.value) - .collect(Collectors.toList()); + .toList(); double averageForSameType = average(dataForSameType); getContext().getLog().debug("{} total readings from station {}, type {}, average {}, diff: processingTime - eventTime: {} ms", values.size(), @@ -195,33 +194,31 @@ private Behavior onRecord(Record record) { } private Behavior onQuery(Query query) { - List dataForType = values.stream().filter(d -> d.dataType == query.dataType).collect(Collectors.toList()); + List dataForType = values.stream().filter(d -> d.dataType == query.dataType).toList(); final List queryResult; if (dataForType.isEmpty()) { - queryResult = Collections.emptyList(); + queryResult = List.of(); } else { - switch (query.func) { - case Average: - long start = dataForType.stream().findFirst().map(d -> d.eventTime).orElse(0L); - long end = dataForType.isEmpty() ? 0 : dataForType.get(dataForType.size() - 1).eventTime; - List valuesForType = dataForType.stream().map(d -> d.value).collect(Collectors.toList()); - queryResult = Collections.singletonList(new TimeWindow(start, end, average(valuesForType))); - break; - case HighLow: + queryResult = switch (query.func) { + case Average -> { + long start = dataForType.get(0).eventTime; + long end = dataForType.get(dataForType.size() - 1).eventTime; + List valuesForType = dataForType.stream().map(d -> d.value).toList(); + yield List.of(new TimeWindow(start, end, average(valuesForType))); + } + case HighLow -> { Data min = dataForType.stream().reduce((a, b) -> a.value < b.value ? a : b).get(); Data max = dataForType.stream().reduce((a, b) -> a.value > b.value ? a : b).get(); - queryResult = Arrays.asList( + yield List.of( new TimeWindow(min.eventTime, max.eventTime, min.value), new TimeWindow(min.eventTime, max.eventTime, max.value)); - break; - case Current: + } + case Current -> { // we know it is not empty from up above Data current = dataForType.get(dataForType.size() - 1); - queryResult = Collections.singletonList(new TimeWindow(current.eventTime, current.eventTime, current.value)); - break; - default: - throw new IllegalArgumentException("Unknown operation " + query.func); - } + yield List.of(new TimeWindow(current.eventTime, current.eventTime, current.value)); + } + }; } query.replyTo.tell(new QueryResult(wsid, query.dataType, query.func, dataForType.size(), queryResult)); return this; diff --git a/pekko-sample-sharding-java/project/build.properties b/pekko-sample-sharding-java/project/build.properties index df061f4f..36860735 100644 --- a/pekko-sample-sharding-java/project/build.properties +++ b/pekko-sample-sharding-java/project/build.properties @@ -1 +1 @@ -sbt.version=1.12.9 +sbt.version=1.13.1 diff --git a/pekko-sample-sharding-scala/.jvmopts b/pekko-sample-sharding-scala/.jvmopts new file mode 100644 index 00000000..4df36e78 --- /dev/null +++ b/pekko-sample-sharding-scala/.jvmopts @@ -0,0 +1 @@ +--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED diff --git a/pekko-sample-sharding-scala/build.sbt b/pekko-sample-sharding-scala/build.sbt index bad87437..c15b3ec8 100644 --- a/pekko-sample-sharding-scala/build.sbt +++ b/pekko-sample-sharding-scala/build.sbt @@ -1,10 +1,11 @@ -val pekkoVersion = "1.5.0" -val pekkoHttpVersion = "1.3.0" +ThisBuild / evictionErrorLevel := Level.Info +val pekkoVersion = "2.0.0" +val pekkoHttpVersion = "2.0.0-M2" val logbackVersion = "1.3.15" lazy val buildSettings = Seq( organization := "org.apache.pekko", - scalaVersion := "3.3.7") + scalaVersion := "3.3.9") lazy val commonScalacOptions = Seq( "-deprecation", diff --git a/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/KillrWeather.scala b/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/KillrWeather.scala index 60f8b8a9..9dea40f4 100644 --- a/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/KillrWeather.scala +++ b/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/KillrWeather.scala @@ -4,7 +4,7 @@ import org.apache.pekko.actor.AddressFromURIString import org.apache.pekko.actor.typed.ActorSystem import com.typesafe.config.Config import com.typesafe.config.ConfigFactory -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ /** * Main entry point for the application. diff --git a/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherHttpServer.scala b/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherHttpServer.scala index 372ef50e..052f4f9a 100644 --- a/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherHttpServer.scala +++ b/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherHttpServer.scala @@ -21,7 +21,7 @@ private[killrweather] object WeatherHttpServer { import system.executionContext - Http().bindAndHandle(routes, "localhost", port).onComplete { + Http().newServerAt("localhost", port).bind(routes).onComplete { case Success(binding) => val address = binding.localAddress system.log.info( diff --git a/pekko-sample-sharding-scala/project/build.properties b/pekko-sample-sharding-scala/project/build.properties index df061f4f..36860735 100644 --- a/pekko-sample-sharding-scala/project/build.properties +++ b/pekko-sample-sharding-scala/project/build.properties @@ -1 +1 @@ -sbt.version=1.12.9 +sbt.version=1.13.1