Scala 2.13.0 rc2 (#26967)
This commit is contained in:
parent
24a3bba135
commit
814cfa286c
168 changed files with 396 additions and 315 deletions
|
|
@ -26,6 +26,8 @@ import scala.util.control.NonFatal
|
|||
|
||||
import akka.event.Logging.LogLevel
|
||||
|
||||
import com.github.ghik.silencer.silent
|
||||
|
||||
/**
|
||||
* Cluster Extension Id and factory for creating Cluster extension.
|
||||
*/
|
||||
|
|
@ -94,6 +96,7 @@ class Cluster(val system: ExtendedActorSystem) extends Extension {
|
|||
/**
|
||||
* Java API: roles that this member has
|
||||
*/
|
||||
@silent
|
||||
def getSelfRoles: java.util.Set[String] =
|
||||
scala.collection.JavaConverters.setAsJavaSetConverter(selfRoles).asJava
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ import akka.util.ccompat._
|
|||
|
||||
import scala.runtime.AbstractFunction5
|
||||
|
||||
import com.github.ghik.silencer.silent
|
||||
|
||||
/**
|
||||
* Domain events published to the event bus.
|
||||
* Subscribe with:
|
||||
|
|
@ -120,25 +122,28 @@ object ClusterEvent {
|
|||
* Java API: get current member list.
|
||||
*/
|
||||
def getMembers: java.lang.Iterable[Member] = {
|
||||
import scala.collection.JavaConverters._
|
||||
import akka.util.ccompat.JavaConverters._
|
||||
members.asJava
|
||||
}
|
||||
|
||||
/**
|
||||
* Java API: get current unreachable set.
|
||||
*/
|
||||
@silent
|
||||
def getUnreachable: java.util.Set[Member] =
|
||||
scala.collection.JavaConverters.setAsJavaSetConverter(unreachable).asJava
|
||||
|
||||
/**
|
||||
* Java API: All data centers in the cluster
|
||||
*/
|
||||
@silent
|
||||
def getUnreachableDataCenters: java.util.Set[String] =
|
||||
scala.collection.JavaConverters.setAsJavaSetConverter(unreachableDataCenters).asJava
|
||||
|
||||
/**
|
||||
* Java API: get current “seen-by” set.
|
||||
*/
|
||||
@silent
|
||||
def getSeenBy: java.util.Set[Address] =
|
||||
scala.collection.JavaConverters.setAsJavaSetConverter(seenBy).asJava
|
||||
|
||||
|
|
@ -166,6 +171,7 @@ object ClusterEvent {
|
|||
/**
|
||||
* Java API: All node roles in the cluster
|
||||
*/
|
||||
@silent
|
||||
def getAllRoles: java.util.Set[String] =
|
||||
scala.collection.JavaConverters.setAsJavaSetConverter(allRoles).asJava
|
||||
|
||||
|
|
@ -177,6 +183,7 @@ object ClusterEvent {
|
|||
/**
|
||||
* Java API: All data centers in the cluster
|
||||
*/
|
||||
@silent
|
||||
def getAllDataCenters: java.util.Set[String] =
|
||||
scala.collection.JavaConverters.setAsJavaSetConverter(allDataCenters).asJava
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ final class ClusterSettings(val config: Config, val systemName: String) {
|
|||
cc.getInt("min-nr-of-members")
|
||||
}.requiring(_ > 0, "min-nr-of-members must be > 0")
|
||||
val MinNrOfMembersOfRole: Map[String, Int] = {
|
||||
import scala.collection.JavaConverters._
|
||||
import akka.util.ccompat.JavaConverters._
|
||||
cc.getConfig("role")
|
||||
.root
|
||||
.asScala
|
||||
|
|
@ -186,7 +186,7 @@ final class ClusterSettings(val config: Config, val systemName: String) {
|
|||
|
||||
val ByPassConfigCompatCheck: Boolean = !cc.getBoolean("configuration-compatibility-check.enforce-on-join")
|
||||
val ConfigCompatCheckers: Set[String] = {
|
||||
import scala.collection.JavaConverters._
|
||||
import akka.util.ccompat.JavaConverters._
|
||||
cc.getConfig("configuration-compatibility-check.checkers")
|
||||
.root
|
||||
.unwrapped
|
||||
|
|
@ -200,7 +200,7 @@ final class ClusterSettings(val config: Config, val systemName: String) {
|
|||
}
|
||||
|
||||
val SensitiveConfigPaths = {
|
||||
import scala.collection.JavaConverters._
|
||||
import akka.util.ccompat.JavaConverters._
|
||||
|
||||
val sensitiveKeys =
|
||||
cc.getConfig("configuration-compatibility-check.sensitive-config-paths")
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import akka.annotation.{ DoNotInherit, InternalApi }
|
|||
import akka.util.ccompat._
|
||||
import com.typesafe.config.{ Config, ConfigFactory, ConfigValue }
|
||||
|
||||
import scala.collection.JavaConverters._
|
||||
import akka.util.ccompat.JavaConverters._
|
||||
import scala.collection.{ immutable => im }
|
||||
|
||||
abstract class JoinConfigCompatChecker {
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ class Member private[cluster] (
|
|||
/**
|
||||
* Java API
|
||||
*/
|
||||
@silent
|
||||
def getRoles: java.util.Set[String] =
|
||||
scala.collection.JavaConverters.setAsJavaSetConverter(roles).asJava
|
||||
|
||||
|
|
|
|||
|
|
@ -15,14 +15,13 @@ import akka.protobuf.{ ByteString, MessageLite }
|
|||
|
||||
import scala.annotation.tailrec
|
||||
import scala.collection.immutable
|
||||
import scala.collection.JavaConverters._
|
||||
import akka.util.ccompat.JavaConverters._
|
||||
import scala.concurrent.duration.Deadline
|
||||
import akka.annotation.InternalApi
|
||||
import akka.cluster.InternalClusterAction._
|
||||
import akka.cluster.routing.{ ClusterRouterPool, ClusterRouterPoolSettings }
|
||||
import akka.routing.Pool
|
||||
import akka.util.ccompat._
|
||||
import akka.util.ccompat._
|
||||
import com.github.ghik.silencer.silent
|
||||
import com.typesafe.config.{ Config, ConfigFactory, ConfigRenderOptions }
|
||||
|
||||
|
|
@ -184,6 +183,7 @@ final class ClusterMessageSerializer(val system: ExtendedActorSystem)
|
|||
builder.build()
|
||||
}
|
||||
|
||||
@silent
|
||||
private def clusterRouterPoolSettingsToProto(settings: ClusterRouterPoolSettings): cm.ClusterRouterPoolSettings = {
|
||||
val builder = cm.ClusterRouterPoolSettings.newBuilder()
|
||||
builder
|
||||
|
|
@ -193,8 +193,7 @@ final class ClusterMessageSerializer(val system: ExtendedActorSystem)
|
|||
.addAllUseRoles(settings.useRoles.asJava)
|
||||
|
||||
// for backwards compatibility
|
||||
@silent
|
||||
val _ = settings.useRole.foreach(builder.setUseRole)
|
||||
settings.useRole.foreach(builder.setUseRole)
|
||||
|
||||
builder.build()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import com.typesafe.config.ConfigFactory
|
|||
|
||||
import scala.annotation.{ tailrec, varargs }
|
||||
import scala.collection.immutable
|
||||
import scala.collection.JavaConverters._
|
||||
import akka.util.ccompat.JavaConverters._
|
||||
|
||||
object ClusterRouterGroupSettings {
|
||||
@deprecated("useRole has been replaced with useRoles", since = "2.5.4")
|
||||
|
|
|
|||
|
|
@ -770,7 +770,7 @@ abstract class StressSpec
|
|||
.append(" MB")
|
||||
sb.append("\n")
|
||||
|
||||
import scala.collection.JavaConverters._
|
||||
import akka.util.ccompat.JavaConverters._
|
||||
val args = runtime.getInputArguments.asScala.filterNot(_.contains("classpath")).mkString("\n ")
|
||||
sb.append("Args:\n ").append(args)
|
||||
sb.append("\n")
|
||||
|
|
|
|||
|
|
@ -12,8 +12,10 @@ import akka.dispatch.Dispatchers
|
|||
import akka.remote.PhiAccrualFailureDetector
|
||||
import akka.util.Helpers.ConfigOps
|
||||
import akka.actor.Address
|
||||
|
||||
import com.github.ghik.silencer.silent
|
||||
|
||||
@silent
|
||||
class ClusterConfigSpec extends AkkaSpec {
|
||||
|
||||
"Clustering" must {
|
||||
|
|
@ -41,8 +43,7 @@ class ClusterConfigSpec extends AkkaSpec {
|
|||
UnreachableNodesReaperInterval should ===(1 second)
|
||||
PublishStatsInterval should ===(Duration.Undefined)
|
||||
AutoDownUnreachableAfter should ===(Duration.Undefined)
|
||||
@silent
|
||||
val _ = DownRemovalMargin should ===(Duration.Zero)
|
||||
DownRemovalMargin should ===(Duration.Zero)
|
||||
MinNrOfMembers should ===(1)
|
||||
MinNrOfMembersOfRole should ===(Map.empty[String, Int])
|
||||
SelfDataCenter should ===("default")
|
||||
|
|
|
|||
|
|
@ -37,18 +37,20 @@ class JoinConfigCompatPreDefinedChecksSpec extends WordSpec with Matchers {
|
|||
|
||||
"fail when some required keys are NOT provided" in {
|
||||
|
||||
val Invalid(incompatibleKeys) =
|
||||
JoinConfigCompatChecker.exists(
|
||||
requiredKeys,
|
||||
config("""
|
||||
|{
|
||||
| akka.cluster.min-nr-of-members = 1
|
||||
|}
|
||||
""".stripMargin))
|
||||
|
||||
incompatibleKeys should have size 2
|
||||
incompatibleKeys should contain("akka.cluster.retry-unsuccessful-join-after is missing")
|
||||
incompatibleKeys should contain("akka.cluster.allow-weakly-up-members is missing")
|
||||
JoinConfigCompatChecker.exists(
|
||||
requiredKeys,
|
||||
config("""
|
||||
|{
|
||||
| akka.cluster.min-nr-of-members = 1
|
||||
|}
|
||||
""".stripMargin)) match {
|
||||
case Valid =>
|
||||
fail()
|
||||
case Invalid(incompatibleKeys) =>
|
||||
incompatibleKeys should have size 2
|
||||
incompatibleKeys should contain("akka.cluster.retry-unsuccessful-join-after is missing")
|
||||
incompatibleKeys should contain("akka.cluster.allow-weakly-up-members is missing")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -87,56 +89,62 @@ class JoinConfigCompatPreDefinedChecksSpec extends WordSpec with Matchers {
|
|||
|
||||
"fail when some required keys are NOT provided" in {
|
||||
|
||||
val Invalid(incompatibleKeys) =
|
||||
JoinConfigCompatChecker.fullMatch(
|
||||
requiredKeys,
|
||||
config("""
|
||||
|{
|
||||
| akka.cluster.min-nr-of-members = 1
|
||||
|}
|
||||
""".stripMargin),
|
||||
clusterConfig)
|
||||
|
||||
incompatibleKeys should have size 2
|
||||
incompatibleKeys should contain("akka.cluster.retry-unsuccessful-join-after is missing")
|
||||
incompatibleKeys should contain("akka.cluster.allow-weakly-up-members is missing")
|
||||
JoinConfigCompatChecker.fullMatch(
|
||||
requiredKeys,
|
||||
config("""
|
||||
|{
|
||||
| akka.cluster.min-nr-of-members = 1
|
||||
|}
|
||||
""".stripMargin),
|
||||
clusterConfig) match {
|
||||
case Valid =>
|
||||
fail()
|
||||
case Invalid(incompatibleKeys) =>
|
||||
incompatibleKeys should have size 2
|
||||
incompatibleKeys should contain("akka.cluster.retry-unsuccessful-join-after is missing")
|
||||
incompatibleKeys should contain("akka.cluster.allow-weakly-up-members is missing")
|
||||
}
|
||||
}
|
||||
|
||||
"fail when all required keys are passed, but some values don't match cluster config" in {
|
||||
|
||||
val Invalid(incompatibleKeys) =
|
||||
JoinConfigCompatChecker.fullMatch(
|
||||
requiredKeys,
|
||||
config("""
|
||||
|{
|
||||
| akka.cluster.min-nr-of-members = 1
|
||||
| akka.cluster.retry-unsuccessful-join-after = 15s
|
||||
| akka.cluster.allow-weakly-up-members = off
|
||||
|}
|
||||
""".stripMargin),
|
||||
clusterConfig)
|
||||
|
||||
incompatibleKeys should have size 2
|
||||
incompatibleKeys should contain("akka.cluster.retry-unsuccessful-join-after is incompatible")
|
||||
incompatibleKeys should contain("akka.cluster.allow-weakly-up-members is incompatible")
|
||||
JoinConfigCompatChecker.fullMatch(
|
||||
requiredKeys,
|
||||
config("""
|
||||
|{
|
||||
| akka.cluster.min-nr-of-members = 1
|
||||
| akka.cluster.retry-unsuccessful-join-after = 15s
|
||||
| akka.cluster.allow-weakly-up-members = off
|
||||
|}
|
||||
""".stripMargin),
|
||||
clusterConfig) match {
|
||||
case Valid =>
|
||||
fail()
|
||||
case Invalid(incompatibleKeys) =>
|
||||
incompatibleKeys should have size 2
|
||||
incompatibleKeys should contain("akka.cluster.retry-unsuccessful-join-after is incompatible")
|
||||
incompatibleKeys should contain("akka.cluster.allow-weakly-up-members is incompatible")
|
||||
}
|
||||
}
|
||||
|
||||
"fail when all required keys are passed, but some are missing and others don't match cluster config" in {
|
||||
|
||||
val Invalid(incompatibleKeys) =
|
||||
JoinConfigCompatChecker.fullMatch(
|
||||
requiredKeys,
|
||||
config("""
|
||||
|{
|
||||
| akka.cluster.min-nr-of-members = 1
|
||||
| akka.cluster.allow-weakly-up-members = off
|
||||
|}
|
||||
""".stripMargin),
|
||||
clusterConfig)
|
||||
|
||||
incompatibleKeys should have size 2
|
||||
incompatibleKeys should contain("akka.cluster.retry-unsuccessful-join-after is missing")
|
||||
incompatibleKeys should contain("akka.cluster.allow-weakly-up-members is incompatible")
|
||||
JoinConfigCompatChecker.fullMatch(
|
||||
requiredKeys,
|
||||
config("""
|
||||
|{
|
||||
| akka.cluster.min-nr-of-members = 1
|
||||
| akka.cluster.allow-weakly-up-members = off
|
||||
|}
|
||||
""".stripMargin),
|
||||
clusterConfig) match {
|
||||
case Valid =>
|
||||
fail()
|
||||
case Invalid(incompatibleKeys) =>
|
||||
incompatibleKeys should have size 2
|
||||
incompatibleKeys should contain("akka.cluster.retry-unsuccessful-join-after is missing")
|
||||
incompatibleKeys should contain("akka.cluster.allow-weakly-up-members is incompatible")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import collection.immutable.SortedSet
|
|||
import akka.testkit.{ AkkaSpec, TestKit }
|
||||
import com.github.ghik.silencer.silent
|
||||
import com.typesafe.config.ConfigFactory
|
||||
|
||||
@silent
|
||||
class ClusterMessageSerializerSpec extends AkkaSpec("akka.actor.provider = cluster") {
|
||||
|
||||
val serializer = new ClusterMessageSerializer(system.asInstanceOf[ExtendedActorSystem])
|
||||
|
|
@ -148,8 +148,7 @@ class ClusterMessageSerializerSpec extends AkkaSpec("akka.actor.provider = clust
|
|||
pool.settings.totalInstances should ===(123)
|
||||
pool.settings.maxInstancesPerNode should ===(345)
|
||||
pool.settings.allowLocalRoutees should ===(true)
|
||||
@silent
|
||||
val _ = pool.settings.useRole should ===(Some("role ABC"))
|
||||
pool.settings.useRole should ===(Some("role ABC"))
|
||||
pool.settings.useRoles should ===(Set("role ABC"))
|
||||
}
|
||||
} finally {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue