diff --git a/.scala-steward.conf b/.scala-steward.conf index 31befd59..bd1196e6 100644 --- a/.scala-steward.conf +++ b/.scala-steward.conf @@ -2,7 +2,7 @@ pullRequests.frequency = "@monthly" updates.pin = [ # To be updated in tandem with upstream Akka - {groupId = "com.fasterxml.jackson.core", version = "2.15."} + {groupId = "com.fasterxml.jackson.core", version = "2.17."} {groupId = "org.scalatest", artifactId = "scalatest", version = "3.2."} ] diff --git a/cluster-bootstrap/src/main/scala/akka/management/cluster/bootstrap/ClusterBootstrapSettings.scala b/cluster-bootstrap/src/main/scala/akka/management/cluster/bootstrap/ClusterBootstrapSettings.scala index 690620ae..943b61c5 100644 --- a/cluster-bootstrap/src/main/scala/akka/management/cluster/bootstrap/ClusterBootstrapSettings.scala +++ b/cluster-bootstrap/src/main/scala/akka/management/cluster/bootstrap/ClusterBootstrapSettings.scala @@ -10,10 +10,12 @@ import java.util.concurrent.TimeUnit import akka.actor.ActorSystem import akka.event.LoggingAdapter + import com.typesafe.config.Config + import scala.concurrent.duration.{ FiniteDuration, _ } -import scala.compat.java8.OptionConverters._ -import akka.util.JavaDurationConverters._ +import scala.jdk.DurationConverters._ +import scala.jdk.OptionConverters._ final class ClusterBootstrapSettings(config: Config, log: LoggingAdapter) { import akka.management.AkkaManagementSettings._ @@ -21,7 +23,7 @@ final class ClusterBootstrapSettings(config: Config, log: LoggingAdapter) { val managementBasePath: Option[String] = Option(config.getString("akka.management.http.base-path")).filter(_.trim.nonEmpty) - def getManagementBasePath: Optional[String] = managementBasePath.asJava + def getManagementBasePath: Optional[String] = managementBasePath.toJava private val bootConfig = config.getConfig("akka.management.cluster.bootstrap") @@ -84,16 +86,16 @@ final class ClusterBootstrapSettings(config: Config, log: LoggingAdapter) { } /** Java API */ - def getContactPointDiscoveryServiceName: Optional[String] = contactPointDiscovery.serviceName.asJava + def getContactPointDiscoveryServiceName: Optional[String] = contactPointDiscovery.serviceName.toJava /** Java API */ - def getContactPointDiscoveryServiceNamespace: Optional[String] = contactPointDiscovery.serviceNamespace.asJava + def getContactPointDiscoveryServiceNamespace: Optional[String] = contactPointDiscovery.serviceNamespace.toJava /** Java API */ - def getContactPointDiscoveryPortName: Optional[String] = contactPointDiscovery.portName.asJava + def getContactPointDiscoveryPortName: Optional[String] = contactPointDiscovery.portName.toJava /** Java API */ - def getContactPointDiscoveryProtocol: Optional[String] = contactPointDiscovery.protocol.asJava + def getContactPointDiscoveryProtocol: Optional[String] = contactPointDiscovery.protocol.toJava /** Java API */ def getContactPointDiscoveryEffectiveName(system: ActorSystem): String = contactPointDiscovery.effectiveName(system) @@ -102,10 +104,10 @@ final class ClusterBootstrapSettings(config: Config, log: LoggingAdapter) { def getContactPointDiscoveryMethod: String = contactPointDiscovery.discoveryMethod /** Java API */ - def getContactPointDiscoveryStableMargin: java.time.Duration = contactPointDiscovery.stableMargin.asJava + def getContactPointDiscoveryStableMargin: java.time.Duration = contactPointDiscovery.stableMargin.toJava /** Java API */ - def getContactPointDiscoveryInterval: java.time.Duration = contactPointDiscovery.interval.asJava + def getContactPointDiscoveryInterval: java.time.Duration = contactPointDiscovery.interval.toJava /** Java API */ def getContactPointDiscoveryExponentialBackoffRandomFactor: Double = @@ -113,13 +115,13 @@ final class ClusterBootstrapSettings(config: Config, log: LoggingAdapter) { /** Java API */ def getContactPointDiscoveryExponentialBackoffMax: java.time.Duration = - contactPointDiscovery.exponentialBackoffMax.asJava + contactPointDiscovery.exponentialBackoffMax.toJava /** Java API */ def getContactPointDiscoveryRequiredContactPointsNr: Int = contactPointDiscovery.requiredContactPointsNr /** Java API */ - def getContactPointDiscoveryResolveTimeout: java.time.Duration = contactPointDiscovery.resolveTimeout.asJava + def getContactPointDiscoveryResolveTimeout: java.time.Duration = contactPointDiscovery.resolveTimeout.toJava object contactPoint { private val contactPointConfig = bootConfig.getConfig("contact-point") @@ -149,7 +151,7 @@ final class ClusterBootstrapSettings(config: Config, log: LoggingAdapter) { def getContactPointFallbackPort: Int = contactPoint.fallbackPort /** Java API */ - def getContactPointProbingFailureTimeout: java.time.Duration = contactPoint.probingFailureTimeout.asJava + def getContactPointProbingFailureTimeout: java.time.Duration = contactPoint.probingFailureTimeout.toJava object joinDecider { val implClass: String = bootConfig.getString("join-decider.class") diff --git a/cluster-bootstrap/src/main/scala/akka/management/cluster/bootstrap/JoinDecider.scala b/cluster-bootstrap/src/main/scala/akka/management/cluster/bootstrap/JoinDecider.scala index f8788d3e..fc5b848a 100644 --- a/cluster-bootstrap/src/main/scala/akka/management/cluster/bootstrap/JoinDecider.scala +++ b/cluster-bootstrap/src/main/scala/akka/management/cluster/bootstrap/JoinDecider.scala @@ -6,8 +6,9 @@ package akka.management.cluster.bootstrap import java.time.LocalDateTime -import scala.collection.JavaConverters._ import scala.concurrent.Future +import scala.jdk.CollectionConverters._ + import akka.actor.Address import akka.discovery.ServiceDiscovery.ResolvedTarget diff --git a/cluster-bootstrap/src/main/scala/akka/management/cluster/bootstrap/LowestAddressJoinDecider.scala b/cluster-bootstrap/src/main/scala/akka/management/cluster/bootstrap/LowestAddressJoinDecider.scala index e0d3df03..b9c51b4f 100644 --- a/cluster-bootstrap/src/main/scala/akka/management/cluster/bootstrap/LowestAddressJoinDecider.scala +++ b/cluster-bootstrap/src/main/scala/akka/management/cluster/bootstrap/LowestAddressJoinDecider.scala @@ -6,11 +6,12 @@ package akka.management.cluster.bootstrap import java.time.Duration +import scala.annotation.nowarn import scala.concurrent.Future + import akka.actor.ActorSystem import akka.actor.Address import akka.discovery.ServiceDiscovery.ResolvedTarget -import akka.util.unused /** * The decision of joining "self" is made by deterministically sorting the discovered services @@ -140,7 +141,8 @@ class LowestAddressJoinDecider(system: ActorSystem, settings: ClusterBootstrapSe * contact points have not been confirmed (unreachable or not running). * `hasEnoughContactPoints` and `isPastStableMargin` must still be fulfilled. */ - protected def isConfirmedCommunicationWithAllContactPointsRequired(@unused info: SeedNodesInformation): Boolean = + protected def isConfirmedCommunicationWithAllContactPointsRequired( + @nowarn("msg=never used") info: SeedNodesInformation): Boolean = settings.contactPointDiscovery.contactWithAllContactPoints /** diff --git a/cluster-http/src/main/scala/akka/management/cluster/javadsl/ClusterMembershipCheck.scala b/cluster-http/src/main/scala/akka/management/cluster/javadsl/ClusterMembershipCheck.scala index 1f598124..5f248277 100644 --- a/cluster-http/src/main/scala/akka/management/cluster/javadsl/ClusterMembershipCheck.scala +++ b/cluster-http/src/main/scala/akka/management/cluster/javadsl/ClusterMembershipCheck.scala @@ -8,9 +8,10 @@ import java.util.concurrent.CompletionStage import akka.management.cluster.scaladsl.{ ClusterMembershipCheck => ScalaClusterReadinessCheck } -import scala.compat.java8.FutureConverters._ +import scala.concurrent.ExecutionContext +import scala.jdk.FutureConverters._ + import akka.actor.ActorSystem -import akka.dispatch.ExecutionContexts class ClusterMembershipCheck(system: ActorSystem) extends java.util.function.Supplier[CompletionStage[java.lang.Boolean]] { @@ -18,6 +19,6 @@ class ClusterMembershipCheck(system: ActorSystem) private val delegate = new ScalaClusterReadinessCheck(system) override def get(): CompletionStage[java.lang.Boolean] = { - delegate.apply().map(Boolean.box)(ExecutionContexts.parasitic).toJava + delegate.apply().map(Boolean.box)(ExecutionContext.parasitic).asJava } } diff --git a/cluster-http/src/main/scala/akka/management/cluster/scaladsl/ClusterMembershipCheck.scala b/cluster-http/src/main/scala/akka/management/cluster/scaladsl/ClusterMembershipCheck.scala index 8ca931f7..2b8759f6 100644 --- a/cluster-http/src/main/scala/akka/management/cluster/scaladsl/ClusterMembershipCheck.scala +++ b/cluster-http/src/main/scala/akka/management/cluster/scaladsl/ClusterMembershipCheck.scala @@ -10,8 +10,8 @@ import akka.cluster.{ Cluster, MemberStatus } import akka.util.Helpers import com.typesafe.config.Config -import scala.collection.JavaConverters._ import scala.concurrent.Future +import scala.jdk.CollectionConverters._ /** * Internal API diff --git a/discovery-aws-api-async/src/main/scala/akka/discovery/awsapi/ecs/AsyncEcsDiscovery.scala b/discovery-aws-api-async/src/main/scala/akka/discovery/awsapi/ecs/AsyncEcsDiscovery.scala index 35721663..6d3ae6e6 100644 --- a/discovery-aws-api-async/src/main/scala/akka/discovery/awsapi/ecs/AsyncEcsDiscovery.scala +++ b/discovery-aws-api-async/src/main/scala/akka/discovery/awsapi/ecs/AsyncEcsDiscovery.scala @@ -6,7 +6,7 @@ package akka.discovery.awsapi.ecs import java.net.{ InetAddress, NetworkInterface } -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import akka.annotation.ApiMayChange diff --git a/discovery-aws-api-async/src/main/scala/akka/discovery/awsapi/ecs/AsyncEcsServiceDiscovery.scala b/discovery-aws-api-async/src/main/scala/akka/discovery/awsapi/ecs/AsyncEcsServiceDiscovery.scala index f4d9908c..6c9f8724 100644 --- a/discovery-aws-api-async/src/main/scala/akka/discovery/awsapi/ecs/AsyncEcsServiceDiscovery.scala +++ b/discovery-aws-api-async/src/main/scala/akka/discovery/awsapi/ecs/AsyncEcsServiceDiscovery.scala @@ -7,11 +7,11 @@ package akka.discovery.awsapi.ecs import java.net.InetAddress import java.util.concurrent.TimeoutException -import scala.collection.JavaConverters._ import scala.collection.immutable.Seq -import scala.compat.java8.FutureConverters.toScala import scala.concurrent.duration._ import scala.concurrent.{ ExecutionContext, Future } +import scala.jdk.CollectionConverters._ +import scala.jdk.FutureConverters._ import scala.util.Try import akka.actor.ActorSystem @@ -98,8 +98,8 @@ object AsyncEcsServiceDiscovery { accumulator: Seq[String] = Seq.empty )(implicit ec: ExecutionContext): Future[Seq[String]] = for { - listTasksResponse <- toScala( - ecsClient.listTasks( + listTasksResponse <- ecsClient + .listTasks( ListTasksRequest .builder() .cluster(cluster) @@ -108,7 +108,7 @@ object AsyncEcsServiceDiscovery { .desiredStatus(DesiredStatus.RUNNING) .build() ) - ) + .asScala accumulatedTasksArns = accumulator ++ listTasksResponse.taskArns().asScala taskArns <- listTasksResponse.nextToken() match { case null => @@ -131,11 +131,11 @@ object AsyncEcsServiceDiscovery { for { // Each DescribeTasksRequest can contain at most 100 task ARNs. describeTasksResponses <- Future.traverse(taskArns.grouped(100))(taskArnGroup => - toScala( - ecsClient.describeTasks( + ecsClient + .describeTasks( DescribeTasksRequest.builder().cluster(cluster).tasks(taskArnGroup.asJava).include(TaskField.TAGS).build() ) - )) + .asScala) tasks = describeTasksResponses.flatMap(_.tasks().asScala).toList } yield tasks diff --git a/discovery-aws-api-async/src/main/scala/akka/discovery/awsapi/ecs/AsyncEcsTaskSetDiscovery.scala b/discovery-aws-api-async/src/main/scala/akka/discovery/awsapi/ecs/AsyncEcsTaskSetDiscovery.scala index c5cdedbb..ced6f209 100644 --- a/discovery-aws-api-async/src/main/scala/akka/discovery/awsapi/ecs/AsyncEcsTaskSetDiscovery.scala +++ b/discovery-aws-api-async/src/main/scala/akka/discovery/awsapi/ecs/AsyncEcsTaskSetDiscovery.scala @@ -7,11 +7,11 @@ package akka.discovery.awsapi.ecs import java.net.InetAddress import java.util.concurrent.TimeoutException -import scala.collection.JavaConverters._ import scala.collection.immutable.Seq -import scala.compat.java8.FutureConverters.toScala import scala.concurrent.duration._ import scala.concurrent.{ ExecutionContext, Future } +import scala.jdk.FutureConverters._ +import scala.jdk.CollectionConverters._ import scala.util.Try import akka.actor.ActorSystem @@ -131,11 +131,13 @@ object AsyncEcsTaskSetDiscovery { private[this] def resolveTaskSet(ecsClient: EcsAsyncClient, cluster: String, taskArn: String)( implicit ec: ExecutionContext ): Future[Option[TaskSet]] = - toScala( - ecsClient.describeTasks( + ecsClient + .describeTasks( DescribeTasksRequest.builder().cluster(cluster).tasks(taskArn).include(TaskField.TAGS).build() ) - ).map(_.tasks().asScala.headOption).map(_.map(task => TaskSet(task.startedBy()))) + .asScala + .map(_.tasks().asScala.headOption) + .map(_.map(task => TaskSet(task.startedBy()))) private[this] def listTaskArns( ecsClient: EcsAsyncClient, @@ -145,8 +147,8 @@ object AsyncEcsTaskSetDiscovery { accumulator: Seq[String] = Seq.empty )(implicit ec: ExecutionContext): Future[Seq[String]] = for { - listTasksResponse <- toScala( - ecsClient.listTasks( + listTasksResponse <- ecsClient + .listTasks( ListTasksRequest .builder() .cluster(cluster) @@ -155,7 +157,7 @@ object AsyncEcsTaskSetDiscovery { .desiredStatus(DesiredStatus.RUNNING) .build() ) - ) + .asScala accumulatedTasksArns = accumulator ++ listTasksResponse.taskArns().asScala taskArns <- listTasksResponse.nextToken() match { case null => @@ -178,11 +180,11 @@ object AsyncEcsTaskSetDiscovery { for { // Each DescribeTasksRequest can contain at most 100 task ARNs. describeTasksResponses <- Future.traverse(taskArns.grouped(100))(taskArnGroup => - toScala( - ecsClient.describeTasks( + ecsClient + .describeTasks( DescribeTasksRequest.builder().cluster(cluster).tasks(taskArnGroup.asJava).include(TaskField.TAGS).build() ) - )) + .asScala) tasks = describeTasksResponses.flatMap(_.tasks().asScala).toList } yield tasks diff --git a/discovery-aws-api/src/main/scala/akka/discovery/awsapi/ec2/Ec2TagBasedServiceDiscovery.scala b/discovery-aws-api/src/main/scala/akka/discovery/awsapi/ec2/Ec2TagBasedServiceDiscovery.scala index e3ec31f0..9e5a2bc8 100644 --- a/discovery-aws-api/src/main/scala/akka/discovery/awsapi/ec2/Ec2TagBasedServiceDiscovery.scala +++ b/discovery-aws-api/src/main/scala/akka/discovery/awsapi/ec2/Ec2TagBasedServiceDiscovery.scala @@ -20,10 +20,10 @@ import com.amazonaws.retry.PredefinedRetryPolicies import com.amazonaws.services.ec2.model.{ DescribeInstancesRequest, Filter, Reservation } import com.amazonaws.services.ec2.{ AmazonEC2, AmazonEC2ClientBuilder } import scala.annotation.tailrec -import scala.collection.JavaConverters._ import scala.collection.immutable.Seq import scala.concurrent.duration.FiniteDuration import scala.concurrent.{ ExecutionContext, Future } +import scala.jdk.CollectionConverters._ import scala.util.{ Failure, Success, Try } /** INTERNAL API */ diff --git a/discovery-aws-api/src/main/scala/akka/discovery/awsapi/ecs/EcsServiceDiscovery.scala b/discovery-aws-api/src/main/scala/akka/discovery/awsapi/ecs/EcsServiceDiscovery.scala index 8c7d1af5..c740d767 100644 --- a/discovery-aws-api/src/main/scala/akka/discovery/awsapi/ecs/EcsServiceDiscovery.scala +++ b/discovery-aws-api/src/main/scala/akka/discovery/awsapi/ecs/EcsServiceDiscovery.scala @@ -18,10 +18,10 @@ import com.amazonaws.retry.PredefinedRetryPolicies import com.amazonaws.services.ecs.model.{ DescribeTasksRequest, DesiredStatus, ListTasksRequest, Task } import com.amazonaws.services.ecs.{ AmazonECS, AmazonECSClientBuilder } import scala.annotation.tailrec -import scala.collection.JavaConverters._ import scala.collection.immutable.Seq import scala.concurrent.{ ExecutionContext, Future } import scala.concurrent.duration._ +import scala.jdk.CollectionConverters._ import scala.util.Try final class EcsServiceDiscovery(system: ActorSystem) extends ServiceDiscovery { diff --git a/discovery-aws-api/src/test/scala/akka/discovery/awsapi/ec2/Ec2TagBasedSimpleServiceDiscoveryTest.scala b/discovery-aws-api/src/test/scala/akka/discovery/awsapi/ec2/Ec2TagBasedSimpleServiceDiscoveryTest.scala index 24ed44f4..84df01de 100644 --- a/discovery-aws-api/src/test/scala/akka/discovery/awsapi/ec2/Ec2TagBasedSimpleServiceDiscoveryTest.scala +++ b/discovery-aws-api/src/test/scala/akka/discovery/awsapi/ec2/Ec2TagBasedSimpleServiceDiscoveryTest.scala @@ -11,7 +11,7 @@ import org.scalatest.matchers.should.Matchers class FiltersParsingTest extends AnyFunSuite with Matchers { - import scala.collection.JavaConverters._ + import scala.jdk.CollectionConverters._ test("empty string does not break parsing") { val filters = "" diff --git a/discovery-kubernetes-api/src/main/scala/akka/discovery/kubernetes/Settings.scala b/discovery-kubernetes-api/src/main/scala/akka/discovery/kubernetes/Settings.scala index c086e5ce..59cbcbba 100644 --- a/discovery-kubernetes-api/src/main/scala/akka/discovery/kubernetes/Settings.scala +++ b/discovery-kubernetes-api/src/main/scala/akka/discovery/kubernetes/Settings.scala @@ -9,7 +9,7 @@ import java.util.Optional import akka.actor._ import com.typesafe.config.Config -import scala.compat.java8.OptionConverters._ +import scala.jdk.OptionConverters._ final class Settings(system: ExtendedActorSystem) extends Extension { @@ -48,7 +48,7 @@ final class Settings(system: ExtendedActorSystem) extends Extension { kubernetesApi.optDefinedValue("pod-namespace") /** Java API */ - def getPodNamespace: Optional[String] = podNamespace.asJava + def getPodNamespace: Optional[String] = podNamespace.toJava val podDomain: String = kubernetesApi.getString("pod-domain") diff --git a/integration-test/aws-api-ec2/build.sbt b/integration-test/aws-api-ec2/build.sbt index 960dc6ba..355041ca 100644 --- a/integration-test/aws-api-ec2/build.sbt +++ b/integration-test/aws-api-ec2/build.sbt @@ -8,6 +8,6 @@ libraryDependencies += "com.amazonaws" % "aws-java-sdk-cloudformation" % "1.12.6 libraryDependencies += "com.amazonaws" % "aws-java-sdk-autoscaling" % "1.12.635" % Test -libraryDependencies += "com.fasterxml.jackson.core" % "jackson-databind" % "2.15.3" // aws SDK depends on insecure jackson +libraryDependencies += "com.fasterxml.jackson.core" % "jackson-databind" % "2.17.2" // aws SDK depends on insecure jackson libraryDependencies += "org.scalatest" %% "scalatest" % Dependencies.ScalaTestVersion % Test diff --git a/integration-test/aws-api-ec2/src/test/scala/akka/cluster/bootstrap/IntegrationTest.scala b/integration-test/aws-api-ec2/src/test/scala/akka/cluster/bootstrap/IntegrationTest.scala index a45a9ad9..1b2a14b2 100644 --- a/integration-test/aws-api-ec2/src/test/scala/akka/cluster/bootstrap/IntegrationTest.scala +++ b/integration-test/aws-api-ec2/src/test/scala/akka/cluster/bootstrap/IntegrationTest.scala @@ -59,7 +59,7 @@ class IntegrationTest with SpanSugar with Matchers { - import collection.JavaConverters._ + import scala.jdk.CollectionConverters._ private val buildId: String = System.getenv("BUILD_ID") assert(buildId != null, "BUILD_ID environment variable has to be defined") diff --git a/integration-test/dns-api-mesos/build.sbt b/integration-test/dns-api-mesos/build.sbt new file mode 100644 index 00000000..1fb9c96e --- /dev/null +++ b/integration-test/dns-api-mesos/build.sbt @@ -0,0 +1,17 @@ +enablePlugins(JavaAppPackaging) + +resolvers += "Akka library repository".at("https://repo.akka.io/maven") + +name := "bootstrap-demo-dns-api" + +scalaVersion := "2.13.14" + +def akkaManagementVersion(version: String) = version.split('+')(0) + +libraryDependencies += "com.lightbend.akka.management" %% "akka-management-cluster-bootstrap" % akkaManagementVersion( + version.value) + +libraryDependencies += "com.lightbend.akka.management" %% "akka-management-cluster-http" % akkaManagementVersion( + version.value) + +libraryDependencies += "com.typesafe.akka" %% "akka-discovery" % "2.10.0-M1" diff --git a/integration-test/kubernetes-api-java/pom.xml b/integration-test/kubernetes-api-java/pom.xml index 047b2ea4..f5998112 100644 --- a/integration-test/kubernetes-api-java/pom.xml +++ b/integration-test/kubernetes-api-java/pom.xml @@ -17,8 +17,8 @@ UTF-8 11 - 2.9.3 - 10.6.3 + 2.10.0-M1 + 10.7.0-M1 1.5.2 2.13 @@ -50,7 +50,7 @@ ch.qos.logback logback-classic - 1.2.13 + 1.5.7 com.lightbend.akka.management diff --git a/lease-kubernetes/src/main/scala/akka/coordination/lease/kubernetes/KubernetesSettings.scala b/lease-kubernetes/src/main/scala/akka/coordination/lease/kubernetes/KubernetesSettings.scala index 5d213053..9b2d60cf 100644 --- a/lease-kubernetes/src/main/scala/akka/coordination/lease/kubernetes/KubernetesSettings.scala +++ b/lease-kubernetes/src/main/scala/akka/coordination/lease/kubernetes/KubernetesSettings.scala @@ -7,10 +7,10 @@ package akka.coordination.lease.kubernetes import akka.actor.ActorSystem import akka.annotation.InternalApi import akka.coordination.lease.TimeoutSettings -import akka.util.JavaDurationConverters._ import com.typesafe.config.Config import scala.concurrent.duration.{ FiniteDuration, _ } +import scala.jdk.DurationConverters._ /** * INTERNAL API @@ -35,7 +35,7 @@ private[akka] object KubernetesSettings { val apiServerRequestTimeout = if (config.hasDefined("api-server-request-timeout")) - config.getDuration("api-server-request-timeout").asScala + config.getDuration("api-server-request-timeout").toScala else leaseTimeoutSettings.operationTimeout * 2 / 5 // 2/5 gives two API operations + a buffer diff --git a/management-pki/src/main/scala/akka/pki/kubernetes/PemManagersProvider.scala b/management-pki/src/main/scala/akka/pki/kubernetes/PemManagersProvider.scala index 6ddbe878..a41e9ff3 100644 --- a/management-pki/src/main/scala/akka/pki/kubernetes/PemManagersProvider.scala +++ b/management-pki/src/main/scala/akka/pki/kubernetes/PemManagersProvider.scala @@ -4,7 +4,6 @@ package akka.pki.kubernetes -import collection.JavaConverters._ import java.io.ByteArrayInputStream import java.io.File import java.nio.charset.Charset @@ -13,7 +12,10 @@ import java.security.KeyStore import java.security.PrivateKey import java.security.cert.Certificate import java.security.cert.CertificateFactory + import scala.concurrent.blocking +import scala.jdk.CollectionConverters._ + import akka.annotation.InternalApi import akka.pki.pem.DERPrivateKeyLoader import akka.pki.pem.PEMDecoder diff --git a/management/src/main/scala/akka/management/AkkaManagementSettings.scala b/management/src/main/scala/akka/management/AkkaManagementSettings.scala index ea8ac680..ea117b3a 100644 --- a/management/src/main/scala/akka/management/AkkaManagementSettings.scala +++ b/management/src/main/scala/akka/management/AkkaManagementSettings.scala @@ -7,9 +7,9 @@ package akka.management import java.net.InetAddress import java.util.Optional -import scala.collection.JavaConverters._ import scala.collection.immutable -import scala.compat.java8.OptionConverters._ +import scala.jdk.CollectionConverters._ +import scala.jdk.OptionConverters._ import akka.annotation.InternalApi import com.typesafe.config.Config @@ -82,7 +82,7 @@ final class AkkaManagementSettings(val config: Config) { def getHttpEffectiveBindPort: Int = Http.EffectiveBindPort /** Java API */ - def getBasePath: Optional[String] = Http.BasePath.asJava + def getBasePath: Optional[String] = Http.BasePath.toJava /** Java API */ def getHttpRouteProviders: java.util.List[NamedRouteProvider] = Http.RouteProviders.asJava diff --git a/management/src/main/scala/akka/management/HealthCheckSettings.scala b/management/src/main/scala/akka/management/HealthCheckSettings.scala index a231c33a..54d241b3 100644 --- a/management/src/main/scala/akka/management/HealthCheckSettings.scala +++ b/management/src/main/scala/akka/management/HealthCheckSettings.scala @@ -5,11 +5,11 @@ package akka.management import com.typesafe.config.Config -import akka.util.JavaDurationConverters._ -import scala.collection.JavaConverters._ import scala.collection.immutable import scala.concurrent.duration.FiniteDuration +import scala.jdk.CollectionConverters._ +import scala.jdk.DurationConverters._ final case class NamedHealthCheck(name: String, fullyQualifiedClassName: String) @@ -42,7 +42,7 @@ object HealthCheckSettings { .toList, config.getString("readiness-path"), config.getString("liveness-path"), - config.getDuration("check-timeout").asScala + config.getDuration("check-timeout").toScala ) } @@ -65,7 +65,7 @@ object HealthCheckSettings { livenessChecks.asScala.toList, readinessPath, livenessPath, - checkDuration.asScala + checkDuration.toScala ) } @@ -96,5 +96,5 @@ final class HealthCheckSettings( /** * Java API */ - def getCheckTimeout(): java.time.Duration = checkTimeout.asJava + def getCheckTimeout(): java.time.Duration = checkTimeout.toJava } diff --git a/management/src/main/scala/akka/management/internal/HealthChecksImpl.scala b/management/src/main/scala/akka/management/internal/HealthChecksImpl.scala index fce6c8af..55761eea 100644 --- a/management/src/main/scala/akka/management/internal/HealthChecksImpl.scala +++ b/management/src/main/scala/akka/management/internal/HealthChecksImpl.scala @@ -15,9 +15,9 @@ import akka.event.Logging import akka.management.{ HealthCheckSettings, InvalidHealthCheckException, NamedHealthCheck } import akka.management.scaladsl.HealthChecks import scala.collection.immutable -import scala.collection.JavaConverters._ -import scala.compat.java8.FutureConverters._ import scala.concurrent.Future +import scala.jdk.CollectionConverters._ +import scala.jdk.FutureConverters._ import scala.util.control.NonFatal import scala.util.{ Failure, Success, Try } @@ -81,7 +81,7 @@ final private[akka] class HealthChecksImpl(system: ExtendedActorSystem, settings } private def convertSupplierToScala(supplier: Supplier[CompletionStage[JBoolean]]): HealthCheck = { () => - supplier.get().toScala.map(_.booleanValue) + supplier.get().asScala.map(_.booleanValue) } private def tryLoadScalaHealthCheck(fqcn: String): Try[HealthCheck] = { diff --git a/management/src/main/scala/akka/management/javadsl/AkkaManagement.scala b/management/src/main/scala/akka/management/javadsl/AkkaManagement.scala index af699d1b..d0e75800 100644 --- a/management/src/main/scala/akka/management/javadsl/AkkaManagement.scala +++ b/management/src/main/scala/akka/management/javadsl/AkkaManagement.scala @@ -7,7 +7,8 @@ package akka.management.javadsl import java.util.concurrent.CompletionStage import java.util.function.{ Function => JFunction } -import scala.compat.java8.FutureConverters._ +import scala.jdk.FutureConverters._ + import akka.Done import akka.actor.{ ActorSystem, ClassicActorSystemProvider } import akka.http.javadsl.model.Uri @@ -63,16 +64,16 @@ final class AkkaManagement(delegate: scaladsl.AkkaManagement) { * Start an Akka HTTP server to serve the HTTP management endpoint. */ def start(): CompletionStage[Uri] = - delegate.start().map(Uri.create)(delegate.system.dispatcher).toJava + delegate.start().map(Uri.create)(delegate.system.dispatcher).asJava /** * Start an Akka HTTP server to serve the HTTP management endpoint. */ def start(transformSettings: JFunction[ManagementRouteProviderSettings, ManagementRouteProviderSettings]) : CompletionStage[Uri] = - delegate.start(convertSettingsTransformation(transformSettings)).map(Uri.create)(delegate.system.dispatcher).toJava + delegate.start(convertSettingsTransformation(transformSettings)).map(Uri.create)(delegate.system.dispatcher).asJava def stop(): CompletionStage[Done] = - delegate.stop().toJava + delegate.stop().asJava } diff --git a/management/src/main/scala/akka/management/javadsl/HealthChecks.scala b/management/src/main/scala/akka/management/javadsl/HealthChecks.scala index 7b2a6ab3..c56c9dd1 100644 --- a/management/src/main/scala/akka/management/javadsl/HealthChecks.scala +++ b/management/src/main/scala/akka/management/javadsl/HealthChecks.scala @@ -9,8 +9,9 @@ import java.util.function.Supplier import java.util.function.{ Function => JFunction } import java.util.{ Optional, List => JList } -import scala.compat.java8.FunctionConverters._ -import scala.compat.java8.FutureConverters._ +import scala.jdk.FunctionConverters._ +import scala.jdk.FutureConverters._ + import akka.actor.ActorSystem import akka.actor.ExtendedActorSystem import akka.actor.setup.Setup @@ -30,7 +31,7 @@ final class HealthChecks(system: ExtendedActorSystem, settings: HealthCheckSetti * Returns CompletionStage(result), containing the system's readiness result */ def readyResult(): CompletionStage[CheckResult] = - delegate.readyResult().map(new CheckResult(_))(system.dispatcher).toJava + delegate.readyResult().map(new CheckResult(_))(system.dispatcher).asJava /** * Returns CompletionStage(true) if the system is ready to receive user traffic @@ -44,7 +45,7 @@ final class HealthChecks(system: ExtendedActorSystem, settings: HealthCheckSetti * or is loading initial state from a database */ def aliveResult(): CompletionStage[CheckResult] = - delegate.aliveResult().map(new CheckResult(_))(system.dispatcher).toJava + delegate.aliveResult().map(new CheckResult(_))(system.dispatcher).asJava /** * Returns CompletionStage(result) containing the system's liveness result diff --git a/management/src/main/scala/akka/management/scaladsl/AkkaManagement.scala b/management/src/main/scala/akka/management/scaladsl/AkkaManagement.scala index f4c7b860..80a31684 100644 --- a/management/src/main/scala/akka/management/scaladsl/AkkaManagement.scala +++ b/management/src/main/scala/akka/management/scaladsl/AkkaManagement.scala @@ -8,10 +8,10 @@ import java.util.Optional import java.util.concurrent.atomic.AtomicReference import scala.collection.immutable -import scala.compat.java8.FutureConverters._ -import scala.compat.java8.OptionConverters._ import scala.concurrent.Future import scala.concurrent.Promise +import scala.jdk.FutureConverters._ +import scala.jdk.OptionConverters._ import scala.util.Failure import scala.util.Success import scala.util.control.NonFatal @@ -196,7 +196,7 @@ final class AkkaManagement(implicit private[akka] val system: ExtendedActorSyste case provided: Credentials.Provided => Optional.of(ProvidedCredentials(provided)) case _ => Optional.empty() } - authenticateBasicAsync(realm = "secured", c => auth.apply(credsToJava(c)).toScala.map(_.asScala)).optional + authenticateBasicAsync(realm = "secured", c => auth.apply(credsToJava(c)).asScala.map(_.toScala)).optional .apply(_ => inner) case (Some(_), Some(_)) => diff --git a/native-image-tests/build.sbt b/native-image-tests/build.sbt index f0cb0405..7e09bf99 100644 --- a/native-image-tests/build.sbt +++ b/native-image-tests/build.sbt @@ -6,8 +6,8 @@ scalaVersion := "2.13.14" resolvers += "Akka library repository".at("https://repo.akka.io/maven") -lazy val akkaVersion = sys.props.getOrElse("akka.version", "2.9.3") -lazy val akkaHttpVersion = sys.props.getOrElse("akka.http.version", "10.6.3") +lazy val akkaVersion = sys.props.getOrElse("akka.version", "2.10.0-M1") +lazy val akkaHttpVersion = sys.props.getOrElse("akka.http.version", "10.7.0-M1") // Note: this default isn't really used anywhere so not important to bump lazy val akkaManagementVersion = sys.props.getOrElse("akka.management.version", "1.5.2") @@ -35,7 +35,7 @@ libraryDependencies ++= Seq( "com.lightbend.akka.discovery" %% "akka-discovery-kubernetes-api" % akkaManagementVersion, "com.lightbend.akka.management" %% "akka-lease-kubernetes" % akkaManagementVersion, "com.lightbend.akka.management" %% "akka-rolling-update-kubernetes" % akkaManagementVersion, - "ch.qos.logback" % "logback-classic" % "1.2.13" + "ch.qos.logback" % "logback-classic" % "1.5.7" ) // useful for investigations: sbt nativeImageRunAgent diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 387a54c6..caecfe63 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -11,10 +11,10 @@ object Dependencies { val CrossScalaVersions = Seq(Scala213, Scala3) // Align the versions in integration-test/kubernetes-api-java/pom.xml - val AkkaVersion = "2.9.3" + val AkkaVersion = "2.10.0-M1" val AkkaBinaryVersion = VersionNumber(AkkaVersion).numbers match { case Seq(major, minor, _*) => s"$major.$minor" } // Align the versions in integration-test/kubernetes-api-java/pom.xml - val AkkaHttpVersion = "10.6.3" + val AkkaHttpVersion = "10.7.0-M1" val AkkaHttpBinaryVersion = VersionNumber(AkkaHttpVersion).numbers match { case Seq(major, minor, _*) => s"$major.$minor" } val ScalaTestVersion = "3.2.19" @@ -22,10 +22,10 @@ object Dependencies { val AzureIdentityVersion = "1.13.2" val AwsSdkVersion = "1.12.770" - val JacksonVersion = "2.15.4" + val JacksonVersion = "2.17.2" val JacksonDatabindVersion = JacksonVersion - val Log4j2Version = "2.23.1" + val Log4j2Version = "2.24.0" // often called-in transitively with insecure versions of databind / core private val JacksonDatabind = Seq( @@ -100,7 +100,7 @@ object Dependencies { "com.typesafe.akka" %% "akka-actor" % AkkaVersion, "com.typesafe.akka" %% "akka-slf4j" % AkkaVersion, "com.typesafe.akka" %% "akka-stream" % AkkaVersion, - "ch.qos.logback" % "logback-classic" % "1.2.13", + "ch.qos.logback" % "logback-classic" % "1.5.7", "com.typesafe.akka" %% "akka-http" % AkkaHttpVersion, "com.typesafe.akka" %% "akka-http-spray-json" % AkkaHttpVersion, "org.scalatest" %% "scalatest" % ScalaTestVersion % Test, @@ -114,7 +114,7 @@ object Dependencies { "com.typesafe.akka" %% "akka-stream" % AkkaVersion, "org.apache.logging.log4j" % "log4j-core" % Log4j2Version, "org.apache.logging.log4j" % "log4j-api" % Log4j2Version, - "org.apache.logging.log4j" % "log4j-slf4j-impl" % Log4j2Version, + "org.apache.logging.log4j" % "log4j-slf4j2-impl" % Log4j2Version, "com.typesafe.akka" %% "akka-http" % AkkaHttpVersion, "com.typesafe.akka" %% "akka-http-spray-json" % AkkaHttpVersion, "org.scalatest" %% "scalatest" % ScalaTestVersion % Test, @@ -188,7 +188,7 @@ object Dependencies { "com.typesafe.akka" %% "akka-discovery" % AkkaVersion, "com.typesafe.akka" %% "akka-testkit" % AkkaVersion % Test, "com.typesafe.akka" %% "akka-slf4j" % AkkaVersion, - "ch.qos.logback" % "logback-classic" % "1.2.13", + "ch.qos.logback" % "logback-classic" % "1.5.7", "org.scalatest" %% "scalatest" % ScalaTestVersion % Test ) diff --git a/rolling-update-kubernetes/src/main/scala/akka/rollingupdate/kubernetes/KubernetesSettings.scala b/rolling-update-kubernetes/src/main/scala/akka/rollingupdate/kubernetes/KubernetesSettings.scala index 2277af01..cc95b1ee 100644 --- a/rolling-update-kubernetes/src/main/scala/akka/rollingupdate/kubernetes/KubernetesSettings.scala +++ b/rolling-update-kubernetes/src/main/scala/akka/rollingupdate/kubernetes/KubernetesSettings.scala @@ -4,12 +4,12 @@ package akka.rollingupdate.kubernetes -import akka.util.JavaDurationConverters._ import akka.annotation.InternalApi import com.typesafe.config.Config import scala.concurrent.duration._ import scala.jdk.CollectionConverters.ListHasAsScala +import scala.jdk.DurationConverters._ /** * INTERNAL API @@ -36,7 +36,7 @@ private[kubernetes] object KubernetesSettings { val customResourceSettings = new CustomResourceSettings( enabled = config.getBoolean("custom-resource.enabled"), crName = crName, - cleanupAfter = config.getDuration("custom-resource.cleanup-after").asScala + cleanupAfter = config.getDuration("custom-resource.cleanup-after").toScala ) new KubernetesSettings( @@ -48,7 +48,7 @@ private[kubernetes] object KubernetesSettings { config.getString("namespace-path"), config.getString("pod-name"), config.getBoolean("secure-api-server"), - config.getDuration("api-service-request-timeout").asScala, + config.getDuration("api-service-request-timeout").toScala, customResourceSettings, config.getString("revision-annotation") ) diff --git a/rolling-update-kubernetes/src/test/scala/akka/rollingupdate/kubernetes/PodDeletionCostAnnotatorSpec.scala b/rolling-update-kubernetes/src/test/scala/akka/rollingupdate/kubernetes/PodDeletionCostAnnotatorSpec.scala index c27452ab..b92516f2 100644 --- a/rolling-update-kubernetes/src/test/scala/akka/rollingupdate/kubernetes/PodDeletionCostAnnotatorSpec.scala +++ b/rolling-update-kubernetes/src/test/scala/akka/rollingupdate/kubernetes/PodDeletionCostAnnotatorSpec.scala @@ -4,8 +4,8 @@ package akka.rollingupdate.kubernetes -import scala.collection.JavaConverters._ import scala.concurrent.duration._ +import scala.jdk.CollectionConverters._ import akka.actor.ActorSystem import akka.actor.Address diff --git a/samples/akka-sample-cluster-kubernetes-java/pom.xml b/samples/akka-sample-cluster-kubernetes-java/pom.xml index a8c81eb4..477bed5e 100644 --- a/samples/akka-sample-cluster-kubernetes-java/pom.xml +++ b/samples/akka-sample-cluster-kubernetes-java/pom.xml @@ -10,9 +10,9 @@ 17 17 UTF-8 - 2.9.3 + 2.10.0-M1 1.5.3 - 10.6.3 + 10.7.0-M1 2.13 ${git.commit.time}-${git.commit.id.abbrev} @@ -71,7 +71,7 @@ ch.qos.logback logback-classic - 1.2.13 + 1.5.7 com.lightbend.akka.management diff --git a/samples/akka-sample-cluster-kubernetes-scala/build.sbt b/samples/akka-sample-cluster-kubernetes-scala/build.sbt index 70b44ea5..41d95f9f 100644 --- a/samples/akka-sample-cluster-kubernetes-scala/build.sbt +++ b/samples/akka-sample-cluster-kubernetes-scala/build.sbt @@ -34,7 +34,7 @@ libraryDependencies ++= { "com.typesafe.akka" %% "akka-cluster-sharding-typed" % akkaVersion, "com.typesafe.akka" %% "akka-stream-typed" % akkaVersion, "com.typesafe.akka" %% "akka-discovery" % akkaVersion, - "ch.qos.logback" % "logback-classic" % "1.2.13", + "ch.qos.logback" % "logback-classic" % "1.5.7", "com.lightbend.akka.discovery" %% "akka-discovery-kubernetes-api" % akkaManagementVersion, "com.lightbend.akka.management" %% "akka-management-cluster-bootstrap" % akkaManagementVersion, "com.lightbend.akka.management" %% "akka-management-cluster-http" % akkaManagementVersion,