This is an automated email from the ASF dual-hosted git repository.
fanningpj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko.git
The following commit(s) were added to refs/heads/main by this push:
new 5aad47eb6c remove deprecated code from pekko-remote (#1983)
5aad47eb6c is described below
commit 5aad47eb6c84963bb71582b814016a01ec8d8023
Author: PJ Fanning <[email protected]>
AuthorDate: Fri Aug 1 08:53:11 2025 +0100
remove deprecated code from pekko-remote (#1983)
* remove deprecated code from pekko-remote
* undo disassociate changes
* Update Transport.scala
* Update remove-deprecated-methods.excludes
* Update remove-deprecated-methods.excludes
---
.../org/apache/pekko/remote/ContainerFormats.java | 10 --
.../apache/pekko/remote/SystemMessageFormats.java | 10 --
.../java/org/apache/pekko/remote/WireFormats.java | 20 ---
.../remove-deprecated-methods.excludes | 11 ++
.../pekko/remote/RemotingLifecycleEvent.scala | 19 ---
.../serialization/PrimitiveSerializers.scala | 73 ---------
.../FailureInjectorTransportAdapter.scala | 6 -
.../remote/transport/netty/NettyTransport.scala | 9 +-
.../PrimitivesSerializationSpec.scala | 182 ---------------------
.../SystemMessageSerializationSpec.scala | 2 +-
10 files changed, 14 insertions(+), 328 deletions(-)
diff --git a/remote/src/main/java/org/apache/pekko/remote/ContainerFormats.java
b/remote/src/main/java/org/apache/pekko/remote/ContainerFormats.java
index 8c79e9a2b3..f4151493cf 100644
--- a/remote/src/main/java/org/apache/pekko/remote/ContainerFormats.java
+++ b/remote/src/main/java/org/apache/pekko/remote/ContainerFormats.java
@@ -84,16 +84,6 @@ public final class ContainerFormats {
return value;
}
- /**
- * @param value The numeric wire value of the corresponding enum entry.
- * @return The enum associated with the given numeric wire value.
- * @deprecated Use {@link #forNumber(int)} instead.
- */
- @java.lang.Deprecated
- public static PatternType valueOf(int value) {
- return forNumber(value);
- }
-
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
diff --git
a/remote/src/main/java/org/apache/pekko/remote/SystemMessageFormats.java
b/remote/src/main/java/org/apache/pekko/remote/SystemMessageFormats.java
index 287bc0f3a5..c20631e256 100644
--- a/remote/src/main/java/org/apache/pekko/remote/SystemMessageFormats.java
+++ b/remote/src/main/java/org/apache/pekko/remote/SystemMessageFormats.java
@@ -268,16 +268,6 @@ public final class SystemMessageFormats {
return value;
}
- /**
- * @param value The numeric wire value of the corresponding enum entry.
- * @return The enum associated with the given numeric wire value.
- * @deprecated Use {@link #forNumber(int)} instead.
- */
- @java.lang.Deprecated
- public static Type valueOf(int value) {
- return forNumber(value);
- }
-
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
diff --git a/remote/src/main/java/org/apache/pekko/remote/WireFormats.java
b/remote/src/main/java/org/apache/pekko/remote/WireFormats.java
index 33a1e9b879..0443a5e324 100644
--- a/remote/src/main/java/org/apache/pekko/remote/WireFormats.java
+++ b/remote/src/main/java/org/apache/pekko/remote/WireFormats.java
@@ -121,16 +121,6 @@ public final class WireFormats {
return value;
}
- /**
- * @param value The numeric wire value of the corresponding enum entry.
- * @return The enum associated with the given numeric wire value.
- * @deprecated Use {@link #forNumber(int)} instead.
- */
- @java.lang.Deprecated
- public static CommandType valueOf(int value) {
- return forNumber(value);
- }
-
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
@@ -274,16 +264,6 @@ public final class WireFormats {
return value;
}
- /**
- * @param value The numeric wire value of the corresponding enum entry.
- * @return The enum associated with the given numeric wire value.
- * @deprecated Use {@link #forNumber(int)} instead.
- */
- @java.lang.Deprecated
- public static TimeUnit valueOf(int value) {
- return forNumber(value);
- }
-
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
diff --git
a/remote/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
b/remote/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
index 3641a5f9d7..20e6c4a16d 100644
---
a/remote/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
+++
b/remote/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
@@ -17,3 +17,14 @@
# Remove deprecated methods
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.remote.RemoteActorRefProvider#RemotingTerminator.setTimer*")
+ProblemFilters.exclude[MissingTypesProblem]("org.apache.pekko.remote.QuarantinedEvent$")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.remote.QuarantinedEvent.apply")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.remote.QuarantinedEvent.curried")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.remote.QuarantinedEvent.uid")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.remote.QuarantinedEvent.this")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.remote.QuarantinedEvent.tupled")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.remote.serialization.ByteStringSerializer")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.remote.serialization.IntSerializer")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.remote.serialization.LongSerializer")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.remote.serialization.StringSerializer")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.remote.transport.FailureInjectorTransportAdapter$All*")
diff --git
a/remote/src/main/scala/org/apache/pekko/remote/RemotingLifecycleEvent.scala
b/remote/src/main/scala/org/apache/pekko/remote/RemotingLifecycleEvent.scala
index b3f85a3504..aa603b12f0 100644
--- a/remote/src/main/scala/org/apache/pekko/remote/RemotingLifecycleEvent.scala
+++ b/remote/src/main/scala/org/apache/pekko/remote/RemotingLifecycleEvent.scala
@@ -13,8 +13,6 @@
package org.apache.pekko.remote
-import scala.runtime.AbstractFunction2
-
import scala.annotation.nowarn
import org.apache.pekko
@@ -101,14 +99,6 @@ final case class RemotingErrorEvent(cause: Throwable)
extends RemotingLifecycleE
override def toString: String = s"Remoting error: [${cause.getMessage}]
[${Logging.stackTraceFor(cause)}]"
}
-// For binary compatibility
-@deprecated("Classic remoting is deprecated, use Artery", "Akka 2.6.0")
-object QuarantinedEvent extends AbstractFunction2[Address, Int,
QuarantinedEvent] {
-
- @deprecated("Use long uid apply", "Akka 2.4.x")
- def apply(address: Address, uid: Int) = new QuarantinedEvent(address, uid)
-}
-
@SerialVersionUID(1L)
@deprecated("Classic remoting is deprecated, use Artery", "Akka 2.6.0")
final case class QuarantinedEvent(address: Address, longUid: Long) extends
RemotingLifecycleEvent {
@@ -118,15 +108,6 @@ final case class QuarantinedEvent(address: Address,
longUid: Long) extends Remot
s"Association to [$address] having UID [$longUid] is irrecoverably failed.
UID is now quarantined and all " +
"messages to this UID will be delivered to dead letters. Remote
ActorSystem must be restarted to recover " +
"from this situation."
-
- // For binary compatibility
-
- @deprecated("Use long uid constructor", "Akka 2.4.x")
- def this(address: Address, uid: Int) = this(address, uid.toLong)
-
- @deprecated("Use long uid", "Akka 2.4.x")
- def uid: Int = longUid.toInt
-
}
/**
diff --git
a/remote/src/main/scala/org/apache/pekko/remote/serialization/PrimitiveSerializers.scala
b/remote/src/main/scala/org/apache/pekko/remote/serialization/PrimitiveSerializers.scala
deleted file mode 100644
index 28f5b84de2..0000000000
---
a/remote/src/main/scala/org/apache/pekko/remote/serialization/PrimitiveSerializers.scala
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-package org.apache.pekko.remote.serialization
-
-import java.nio.ByteBuffer
-
-import org.apache.pekko
-import pekko.actor.ExtendedActorSystem
-import pekko.serialization.BaseSerializer
-import pekko.serialization.ByteBufferSerializer
-
-@deprecated("Moved to org.apache.pekko.serialization.LongSerializer in
pekko-actor", "Akka 2.6.0")
-class LongSerializer(val system: ExtendedActorSystem) extends BaseSerializer
with ByteBufferSerializer {
- // this serializer is not used unless someone is instantiating it manually,
it's not in config
- private val delegate = new pekko.serialization.LongSerializer(system)
-
- override def includeManifest: Boolean = delegate.includeManifest
- override val identifier: Int = delegate.identifier
- override def toBinary(o: AnyRef, buf: ByteBuffer): Unit =
delegate.toBinary(o, buf)
- override def fromBinary(buf: ByteBuffer, manifest: String): AnyRef =
delegate.fromBinary(buf, manifest)
- override def toBinary(o: AnyRef): Array[Byte] = delegate.toBinary(o)
- override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]):
AnyRef = delegate.fromBinary(bytes, manifest)
-}
-
-@deprecated("Moved to org.apache.pekko.serialization.IntSerializer in
pekko-actor", "Akka 2.6.0")
-class IntSerializer(val system: ExtendedActorSystem) extends BaseSerializer
with ByteBufferSerializer {
- // this serializer is not used unless someone is instantiating it manually,
it's not in config
- private val delegate = new pekko.serialization.IntSerializer(system)
-
- override def includeManifest: Boolean = delegate.includeManifest
- override val identifier: Int = delegate.identifier
- override def toBinary(o: AnyRef, buf: ByteBuffer): Unit =
delegate.toBinary(o, buf)
- override def fromBinary(buf: ByteBuffer, manifest: String): AnyRef =
delegate.fromBinary(buf, manifest)
- override def toBinary(o: AnyRef): Array[Byte] = delegate.toBinary(o)
- override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]):
AnyRef = delegate.fromBinary(bytes, manifest)
-}
-
-@deprecated("Moved to org.apache.pekko.serialization.StringSerializer in
pekko-actor", "Akka 2.6.0")
-class StringSerializer(val system: ExtendedActorSystem) extends BaseSerializer
with ByteBufferSerializer {
- // this serializer is not used unless someone is instantiating it manually,
it's not in config
- private val delegate = new pekko.serialization.StringSerializer(system)
-
- override def includeManifest: Boolean = delegate.includeManifest
- override val identifier: Int = delegate.identifier
- override def toBinary(o: AnyRef, buf: ByteBuffer): Unit =
delegate.toBinary(o, buf)
- override def fromBinary(buf: ByteBuffer, manifest: String): AnyRef =
delegate.fromBinary(buf, manifest)
- override def toBinary(o: AnyRef): Array[Byte] = delegate.toBinary(o)
- override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]):
AnyRef = delegate.fromBinary(bytes, manifest)
-}
-
-@deprecated("Moved to org.apache.pekko.serialization.ByteStringSerializer in
pekko-actor", "Akka 2.6.0")
-class ByteStringSerializer(val system: ExtendedActorSystem) extends
BaseSerializer with ByteBufferSerializer {
- // this serializer is not used unless someone is instantiating it manually,
it's not in config
- private val delegate = new
org.apache.pekko.serialization.ByteStringSerializer(system)
-
- override def includeManifest: Boolean = delegate.includeManifest
- override val identifier: Int = delegate.identifier
- override def toBinary(o: AnyRef, buf: ByteBuffer): Unit =
delegate.toBinary(o, buf)
- override def fromBinary(buf: ByteBuffer, manifest: String): AnyRef =
delegate.fromBinary(buf, manifest)
- override def toBinary(o: AnyRef): Array[Byte] = delegate.toBinary(o)
- override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]):
AnyRef = delegate.fromBinary(bytes, manifest)
-}
diff --git
a/remote/src/main/scala/org/apache/pekko/remote/transport/FailureInjectorTransportAdapter.scala
b/remote/src/main/scala/org/apache/pekko/remote/transport/FailureInjectorTransportAdapter.scala
index cb7a2ab8bd..f5c43cc4e1 100644
---
a/remote/src/main/scala/org/apache/pekko/remote/transport/FailureInjectorTransportAdapter.scala
+++
b/remote/src/main/scala/org/apache/pekko/remote/transport/FailureInjectorTransportAdapter.scala
@@ -50,9 +50,6 @@ private[remote] object FailureInjectorTransportAdapter {
trait FailureInjectorCommand
@SerialVersionUID(1L)
- @deprecated("Not implemented", "Akka 2.5.22")
- final case class All(mode: GremlinMode)
- @SerialVersionUID(1L)
final case class One(remoteAddress: Address, mode: GremlinMode)
sealed trait GremlinMode
@@ -89,9 +86,6 @@ private[remote] class FailureInjectorTransportAdapter(
protected def maximumOverhead = 0
override def managementCommand(cmd: Any): Future[Boolean] = cmd match {
- case All(_) =>
- Future.failed(
- new IllegalArgumentException("Setting the mode for all addresses at
once is not currently implemented"))
case One(address, mode) =>
// don't care about the protocol part - we are injected in the stack
anyway!
addressChaosTable.put(address.copy(protocol = "", system = ""), mode)
diff --git
a/remote/src/main/scala/org/apache/pekko/remote/transport/netty/NettyTransport.scala
b/remote/src/main/scala/org/apache/pekko/remote/transport/netty/NettyTransport.scala
index b39235e892..8b7593cc5f 100644
---
a/remote/src/main/scala/org/apache/pekko/remote/transport/netty/NettyTransport.scala
+++
b/remote/src/main/scala/org/apache/pekko/remote/transport/netty/NettyTransport.scala
@@ -181,12 +181,9 @@ class NettyTransportSettings(config: Config) {
case value => value
}
- @deprecated("WARNING: This should only be used by professionals.", "Akka
2.0")
- val PortSelector: Int = getInt("port")
+ private[netty] val PortSelector: Int = getInt("port")
- @deprecated("WARNING: This should only be used by professionals.", "Akka
2.4")
- @nowarn("msg=deprecated")
- val BindPortSelector: Int = getString("bind-port") match {
+ private[netty] val BindPortSelector: Int = getString("bind-port") match {
case "" => PortSelector
case value => value.toInt
}
@@ -516,7 +513,6 @@ class NettyTransport(val settings: NettyTransportSettings,
val system: ExtendedA
}
override def listen: Future[(Address, Promise[AssociationEventListener])] = {
- @nowarn("msg=deprecated")
val bindPort = settings.BindPortSelector
Future.fromTry(Try {
try {
@@ -527,7 +523,6 @@ class NettyTransport(val settings: NettyTransportSettings,
val system: ExtendedA
serverChannel = newServerChannel
- @nowarn("msg=deprecated")
val port = if (settings.PortSelector == 0) None else
Some(settings.PortSelector)
addressFromSocketAddress(
diff --git
a/remote/src/test/scala/org/apache/pekko/remote/serialization/PrimitivesSerializationSpec.scala
b/remote/src/test/scala/org/apache/pekko/remote/serialization/PrimitivesSerializationSpec.scala
deleted file mode 100644
index 7e65d604f1..0000000000
---
a/remote/src/test/scala/org/apache/pekko/remote/serialization/PrimitivesSerializationSpec.scala
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2009-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-package org.apache.pekko.remote.serialization
-
-import java.nio.ByteBuffer
-import java.nio.ByteOrder
-import scala.util.Random
-import com.typesafe.config.ConfigFactory
-import org.apache.pekko
-import pekko.actor.ExtendedActorSystem
-import pekko.serialization.BaseSerializer
-import pekko.serialization.ByteBufferSerializer
-import pekko.serialization.SerializationExtension
-import pekko.serialization.Serializer
-import pekko.testkit.PekkoSpec
-import pekko.util.ByteString
-
-import java.io.NotSerializableException
-
-object PrimitivesSerializationSpec {
- val serializationTestOverrides = ""
-
- val testConfig =
ConfigFactory.parseString(serializationTestOverrides).withFallback(PekkoSpec.testConf)
-}
-
-@deprecated("Moved to org.apache.pekko.serialization.* in pekko-actor", "Akka
2.6.0")
-class PrimitivesSerializationSpec extends
PekkoSpec(PrimitivesSerializationSpec.testConfig) {
-
- val buffer = {
- val b = ByteBuffer.allocate(4096)
- b.order(ByteOrder.LITTLE_ENDIAN)
- b
- }
-
- val serialization = SerializationExtension(system)
- val extSystem = system.asInstanceOf[ExtendedActorSystem]
-
- def verifySerialization(msg: AnyRef): Unit = {
- val deprecatedSerializer: BaseSerializer with ByteBufferSerializer =
serializerFor(msg)
- deprecatedSerializer.fromBinary(deprecatedSerializer.toBinary(msg), None)
should ===(msg)
- }
-
- private def serializerFor(msg: AnyRef) = {
- val serializer = serialization.serializerFor(msg.getClass)
- // testing the deprecated here
- serializer match {
- case _: pekko.serialization.LongSerializer => new
LongSerializer(extSystem)
- case _: pekko.serialization.IntSerializer => new
IntSerializer(extSystem)
- case _: pekko.serialization.StringSerializer => new
StringSerializer(extSystem)
- case _: pekko.serialization.ByteStringSerializer => new
ByteStringSerializer(extSystem)
- case _ => throw new
NotSerializableException()
- }
- }
-
- def verifySerializationByteBuffer(msg: AnyRef): Unit = {
- val serializer = serializerFor(msg).asInstanceOf[Serializer with
ByteBufferSerializer]
- buffer.clear()
- serializer.toBinary(msg, buffer)
- buffer.flip()
-
- // also make sure that the Array and ByteBuffer formats are equal, given
LITTLE_ENDIAN
- val array1 = new Array[Byte](buffer.remaining())
- buffer.get(array1)
- val array2 = serializer.toBinary(msg)
- ByteString(array1) should ===(ByteString(array2))
-
- buffer.rewind()
- serializer.fromBinary(buffer, "") should ===(msg)
- }
-
- "LongSerializer" must {
- Seq(0L, 1L, -1L, Long.MinValue, Long.MinValue + 1L, Long.MaxValue,
Long.MaxValue - 1L)
- .map(_.asInstanceOf[AnyRef])
- .foreach { item =>
- s"resolve serializer for value $item" in {
- serializerFor(item).getClass should ===(classOf[LongSerializer])
- }
-
- s"serialize and de-serialize value $item" in {
- verifySerialization(item)
- }
-
- s"serialize and de-serialize value $item using ByteBuffers" in {
- verifySerializationByteBuffer(item)
- }
- }
-
- "have right serializer id" in {
- // checking because moved to pekko-actor
- serializerFor(1L.asInstanceOf[AnyRef]).identifier === 18
- }
-
- }
-
- "IntSerializer" must {
- Seq(0, 1, -1, Int.MinValue, Int.MinValue + 1, Int.MaxValue, Int.MaxValue -
1).map(_.asInstanceOf[AnyRef]).foreach {
- item =>
- s"resolve serializer for value $item" in {
- serializerFor(item).getClass should ===(classOf[IntSerializer])
- }
-
- s"serialize and de-serialize value $item" in {
- verifySerialization(item)
- }
-
- s"serialize and de-serialize value $item using ByteBuffers" in {
- verifySerializationByteBuffer(item)
- }
- }
-
- "have right serializer id" in {
- // checking because moved to pekko-actor
- serializerFor(1L.asInstanceOf[AnyRef]).identifier === 19
- }
- }
-
- "StringSerializer" must {
- val random = Random.nextString(256)
- Seq("empty string" -> "", "hello" -> "hello", "árvíztűrőütvefúrógép" ->
"árvíztűrőütvefúrógép", "random" -> random)
- .foreach {
- case (scenario, item) =>
- s"resolve serializer for [$scenario]" in {
- serializerFor(item).getClass should ===(classOf[StringSerializer])
- }
-
- s"serialize and de-serialize [$scenario]" in {
- verifySerialization(item)
- }
-
- s"serialize and de-serialize value [$scenario] using ByteBuffers" in
{
- verifySerializationByteBuffer(item)
- }
- }
-
- "have right serializer id" in {
- // checking because moved to pekko-actor
- serializerFor(1L.asInstanceOf[AnyRef]).identifier === 20
- }
-
- }
-
- "ByteStringSerializer" must {
- Seq(
- "empty string" -> ByteString.empty,
- "simple content" -> ByteString("hello"),
- "concatenated content" -> (ByteString("hello") ++ ByteString("world")),
- "sliced content" -> ByteString("helloabc").take(5),
- "large concatenated" ->
- (ByteString(Array.fill[Byte](1000)(1)) ++
ByteString(Array.fill[Byte](1000)(2)))).foreach {
- case (scenario, item) =>
- s"resolve serializer for [$scenario]" in {
- serializerFor(item).getClass should
===(classOf[ByteStringSerializer])
- }
-
- s"serialize and de-serialize [$scenario]" in {
- verifySerialization(item)
- }
-
- s"serialize and de-serialize value [$scenario] using ByteBuffers" in {
- verifySerializationByteBuffer(item)
- }
- }
-
- "have right serializer id" in {
- // checking because moved to pekko-actor
- serializerFor(1L.asInstanceOf[AnyRef]).identifier === 21
- }
-
- }
-
-}
diff --git
a/remote/src/test/scala/org/apache/pekko/remote/serialization/SystemMessageSerializationSpec.scala
b/remote/src/test/scala/org/apache/pekko/remote/serialization/SystemMessageSerializationSpec.scala
index 1488783fe2..31b4c4fdf6 100644
---
a/remote/src/test/scala/org/apache/pekko/remote/serialization/SystemMessageSerializationSpec.scala
+++
b/remote/src/test/scala/org/apache/pekko/remote/serialization/SystemMessageSerializationSpec.scala
@@ -37,7 +37,7 @@ object SystemMessageSerializationSpec {
}
}
-class SystemMessageSerializationSpec extends
PekkoSpec(PrimitivesSerializationSpec.testConfig) {
+class SystemMessageSerializationSpec extends
PekkoSpec(SystemMessageSerializationSpec.testConfig) {
import SystemMessageSerializationSpec._
val testRef = TestProbe().ref.asInstanceOf[InternalActorRef]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]