diff --git a/.gitignore b/.gitignore index 7be56abe..ccf16d5d 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,5 @@ project/build/target/ project/plugins/target/ project/plugins/lib_managed/ project/plugins/src_managed/ +/.bsp +.bsp/sbt.json diff --git a/README.md b/README.md index a9b99bb5..9328463c 100644 --- a/README.md +++ b/README.md @@ -139,14 +139,14 @@ KryoInjection can be composed with Bijections and Injections from `com.twitter.b To use, add a key to your config like: ``` - akka.actor.serializers { - kryo = "com.twitter.chill.akka.AkkaSerializer" + pekko.actor.serializers { + kryo = "com.twitter.chill.pekko.PekkoSerializer" } ``` Then for the super-classes of all your message types, for instance, `java.io.Serializable` (all case classes and case objects are serializable), write: ```scala - akka.actor.serialization-bindings { + pekko.actor.serialization-bindings { "java.io.Serializable" = kryo } ``` @@ -154,13 +154,13 @@ Then for the super-classes of all your message types, for instance, `java.io.Ser With this in place you can now [disable Java serialization entirely](https://doc.akka.io/docs/akka/current/remoting.html#disable-java-serializer): ```scala -akka.actor { +pekko.actor { # Set this to on to enable serialization-bindings defined in # additional-serialization-bindings. Those are by default not included # for backwards compatibility reasons. They are enabled by default if - # akka.remote.artery.enabled=on. - enable-additional-serialization-bindings = on - + # pekko.remote.artery.enabled=on. + enable-additional-serialization-bindings = on + allow-java-serialization = off } ``` diff --git a/build.sbt b/build.sbt index 755831fe..408990b3 100644 --- a/build.sbt +++ b/build.sbt @@ -1,9 +1,9 @@ import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings -val akkaVersion = "2.6.20" +val pekkoVersion = "1.0.2" val algebirdVersion = "0.13.9" val bijectionVersion = "0.9.7" -val kryoVersion = "4.0.2" +val kryoVersion = "4.0.3" val scroogeVersion = "21.2.0" val asmVersion = "4.16" val protobufVersion = "3.22.2" @@ -19,8 +19,8 @@ def scalaVersionSpecificFolders(srcBaseDir: java.io.File, scalaVersion: String): val sharedSettings = Seq( organization := "com.twitter", - scalaVersion := "2.11.12", - crossScalaVersions := Seq("2.11.12", "2.12.17", "2.13.8"), + scalaVersion := "2.12.17", + crossScalaVersions := Seq("2.12.17", "2.13.8"), scalacOptions ++= Seq("-unchecked", "-deprecation"), scalacOptions ++= { scalaVersion.value match { @@ -57,26 +57,26 @@ val sharedSettings = Seq( ), Test / parallelExecution := true, pomExtra := https://github.com/twitter/chill - + - Apache 2 - http://www.apache.org/licenses/LICENSE-2.0.txt + Apache 2 + http://www.apache.org/licenses/LICENSE-2.0.txt repo - A business-friendly OSS license + A business-friendly OSS license - - + + - oscar - Oscar Boykin - http://twitter.com/posco - + oscar + Oscar Boykin + http://twitter.com/posco + - sritchie - Sam Ritchie - http://twitter.com/sritchie - - , + sritchie + Sam Ritchie + http://twitter.com/sritchie + + , Compile / unmanagedSourceDirectories ++= scalaVersionSpecificFolders( (Compile / scalaSource).value, scalaVersion.value @@ -110,7 +110,7 @@ lazy val chillAll = Project( chillHadoop, chillThrift, chillProtobuf, - chillAkka, + chillPekko, chillAvro, chillAlgebird ) @@ -126,7 +126,7 @@ lazy val noPublishSettings = Seq( /** * This returns the youngest jar we released that is compatible with the current. */ -val unreleasedModules = Set[String]("akka") +val unreleasedModules = Set[String]("pekko") val javaOnly = Set[String]("storm", "java", "hadoop", "thrift", "protobuf") val binaryCompatVersion = "0.9.2" @@ -186,18 +186,14 @@ lazy val chill = Project( ) .dependsOn(chillJava) -def akka(scalaVersion: String) = - (scalaVersion match { - case s if s.startsWith("2.11.") => "com.typesafe.akka" %% "akka-actor" % "2.5.32" - case _ => "com.typesafe.akka" %% "akka-actor" % akkaVersion - }) % "provided" +def pekko(scalaVersion: String) = "org.apache.pekko" %% "pekko-actor" % pekkoVersion % "provided" -lazy val chillAkka = module("akka") +lazy val chillPekko = module("pekko") .settings( resolvers += Resolver.typesafeRepo("releases"), libraryDependencies ++= Seq( "com.typesafe" % "config" % "1.4.2", - scalaVersion(sv => akka(sv)).value + scalaVersion(sv => pekko(sv)).value ) ) .dependsOn(chill % "test->test;compile->compile") diff --git a/chill-akka/src/main/scala/com/twitter/chill/akka/ActorRefSerializer.scala b/chill-pekko/src/main/scala/com/twitter/chill/pekko/ActorRefSerializer.scala similarity index 85% rename from chill-akka/src/main/scala/com/twitter/chill/akka/ActorRefSerializer.scala rename to chill-pekko/src/main/scala/com/twitter/chill/pekko/ActorRefSerializer.scala index 365a2ef8..fc4c744e 100644 --- a/chill-akka/src/main/scala/com/twitter/chill/akka/ActorRefSerializer.scala +++ b/chill-pekko/src/main/scala/com/twitter/chill/pekko/ActorRefSerializer.scala @@ -1,4 +1,4 @@ -package com.twitter.chill.akka +package com.twitter.chill.pekko /** * Copyright 2012 Roman Levenstein @@ -12,15 +12,15 @@ package com.twitter.chill.akka * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and limitations under the License. */ -import akka.actor.{ActorPath, ActorRef, ExtendedActorSystem} -import akka.serialization.Serialization +import org.apache.pekko.actor.{ActorPath, ActorRef, ExtendedActorSystem} +import org.apache.pekko.serialization.Serialization import com.esotericsoftware.kryo.{Kryo, Serializer} import com.esotericsoftware.kryo.io.{Input, Output} import com.twitter.chill.{toRich, IKryoRegistrar} /** - * * This module provides helper classes for serialization of Akka-specific classes. + * * This module provides helper classes for serialization of Pekko-specific classes. * * @author * Roman Levenstein diff --git a/chill-akka/src/main/scala/com/twitter/chill/akka/AkkaConfig.scala b/chill-pekko/src/main/scala/com/twitter/chill/pekko/PekkoConfig.scala similarity index 92% rename from chill-akka/src/main/scala/com/twitter/chill/akka/AkkaConfig.scala rename to chill-pekko/src/main/scala/com/twitter/chill/pekko/PekkoConfig.scala index 47a35dd7..12157708 100644 --- a/chill-akka/src/main/scala/com/twitter/chill/akka/AkkaConfig.scala +++ b/chill-pekko/src/main/scala/com/twitter/chill/pekko/PekkoConfig.scala @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package com.twitter.chill.akka +package com.twitter.chill.pekko import com.twitter.chill.config.{Config => ChillConfig} import com.typesafe.config.{Config => TypesafeConfig} @@ -26,7 +26,7 @@ import scala.util.Try * Wraps the immutable typesafe.config.Config in a wrapper that keeps track of the state and follows the * semantics of ChillConfig */ -class AkkaConfig(var typesafeConfig: TypesafeConfig) extends ChillConfig { +class PekkoConfig(var typesafeConfig: TypesafeConfig) extends ChillConfig { /* This is implementing a Java API so that has an assy format */ def get(key: String): String = Try(typesafeConfig.getString(key)).toOption.orNull diff --git a/chill-akka/src/main/scala/com/twitter/chill/akka/AkkaSerializer.scala b/chill-pekko/src/main/scala/com/twitter/chill/pekko/PekkoSerializer.scala similarity index 81% rename from chill-akka/src/main/scala/com/twitter/chill/akka/AkkaSerializer.scala rename to chill-pekko/src/main/scala/com/twitter/chill/pekko/PekkoSerializer.scala index 9e40212d..07b6c2c8 100644 --- a/chill-akka/src/main/scala/com/twitter/chill/akka/AkkaSerializer.scala +++ b/chill-pekko/src/main/scala/com/twitter/chill/pekko/PekkoSerializer.scala @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -package com.twitter.chill.akka +package com.twitter.chill.pekko -import akka.actor.ExtendedActorSystem -import akka.serialization.Serializer +import org.apache.pekko.actor.ExtendedActorSystem +import org.apache.pekko.serialization.Serializer import com.twitter.chill._ import com.twitter.chill.config.ConfiguredInstantiator @@ -27,21 +27,21 @@ import com.twitter.chill.config.ConfiguredInstantiator * * {{{ * - * akka.actor.serializers { - * kryo = "com.twitter.chill.akka.AkkaSerializer" + * org.apache.pekko.actor.serializers { + * kryo = "com.twitter.chill.org.apache.pekko.PekkoSerializer" * } * }}} * * Then for the super-classes of all your message types, for instance, scala.Product, write: * {{{ - * akka.actor.serialization-bindings { + * org.apache.pekko.actor.serialization-bindings { * "scala.Product" = kryo * } * }}} * * Kryo is not thread-safe so we use an object pool to avoid over allocating. */ -class AkkaSerializer(system: ExtendedActorSystem) extends Serializer { +class PekkoSerializer(system: ExtendedActorSystem) extends Serializer { /** * You can override this to easily change your serializers. If you do so, make sure to change the config to @@ -75,8 +75,8 @@ class AkkaSerializer(system: ExtendedActorSystem) extends Serializer { * ConfiguredInstantiator static methods for how to build up a correct Config with your reflected or * serialized instantiators. */ -class ConfiguredAkkaSerializer(system: ExtendedActorSystem) extends AkkaSerializer(system) { +class ConfiguredPekkoSerializer(system: ExtendedActorSystem) extends PekkoSerializer(system) { override def kryoInstantiator: KryoInstantiator = - new ConfiguredInstantiator(new AkkaConfig(system.settings.config)) + new ConfiguredInstantiator(new PekkoConfig(system.settings.config)) .withRegistrar(new ActorRefSerializer(system)) } diff --git a/chill-akka/src/test/scala/com/twitter/chill/akka/AkkaTests.scala b/chill-pekko/src/test/scala/com/twitter/chill/pekko/PekkoTests.scala similarity index 77% rename from chill-akka/src/test/scala/com/twitter/chill/akka/AkkaTests.scala rename to chill-pekko/src/test/scala/com/twitter/chill/pekko/PekkoTests.scala index a621c2ad..cda9476d 100644 --- a/chill-akka/src/test/scala/com/twitter/chill/akka/AkkaTests.scala +++ b/chill-pekko/src/test/scala/com/twitter/chill/pekko/PekkoTests.scala @@ -14,15 +14,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -package com.twitter.chill.akka +package com.twitter.chill.pekko -import akka.actor.{Actor, ActorRef, ActorSystem, Props} -import akka.serialization._ +import org.apache.pekko.actor.{Actor, ActorRef, ActorSystem, Props} +import org.apache.pekko.serialization._ import com.typesafe.config.ConfigFactory import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec -class AkkaTests extends AnyWordSpec with Matchers { +class PekkoTests extends AnyWordSpec with Matchers { object IncActor { def props: Props = Props(IncActor()) } @@ -36,13 +36,13 @@ class AkkaTests extends AnyWordSpec with Matchers { val system: ActorSystem = ActorSystem( "example", ConfigFactory.parseString(""" - akka.actor.serializers { - kryo = "com.twitter.chill.akka.AkkaSerializer" + pekko.actor.serializers { + kryo = "com.twitter.chill.pekko.PekkoSerializer" } - akka.actor.serialization-bindings { + pekko.actor.serialization-bindings { "scala.Product" = kryo - "akka.actor.ActorRef" = kryo + "org.apache.pekko.actor.ActorRef" = kryo } """) ) @@ -50,18 +50,18 @@ class AkkaTests extends AnyWordSpec with Matchers { // Get the Serialization Extension val serialization: Serialization = SerializationExtension(system) - "AkkaSerializer" should { + "PekkoSerializer" should { "be selected for tuples" in { // Find the Serializer for it val serializer = serialization.findSerializerFor((1, 2, 3)) - serializer.getClass.equals(classOf[AkkaSerializer]) should equal(true) + serializer.getClass.equals(classOf[PekkoSerializer]) should equal(true) } def actorRef(i: Int) = system.actorOf(IncActor.props, "incActor" + i) "be selected for ActorRef" in { val serializer = serialization.findSerializerFor(actorRef(1)) - serializer.getClass.equals(classOf[AkkaSerializer]) should equal(true) + serializer.getClass.equals(classOf[PekkoSerializer]) should equal(true) } "serialize and deserialize ActorRef successfully" in {