当前位置: 首页>>代码示例>>Scala>>正文


Scala MultiNodeConfig类代码示例

本文整理汇总了Scala中akka.remote.testkit.MultiNodeConfig的典型用法代码示例。如果您正苦于以下问题:Scala MultiNodeConfig类的具体用法?Scala MultiNodeConfig怎么用?Scala MultiNodeConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MultiNodeConfig类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。

示例1: LeaderDowningAllOtherNodesMultiJvmSpec

//设置package包名称以及导入依赖的类
package akka.cluster

import scala.concurrent.duration._
import akka.remote.testkit.MultiNodeConfig
import akka.remote.testkit.MultiNodeSpec
import akka.testkit._
import com.typesafe.config.ConfigFactory

object LeaderDowningAllOtherNodesMultiJvmSpec extends MultiNodeConfig {
  val first = role("first")
  val second = role("second")
  val third = role("third")
  val fourth = role("fourth")
  val fifth = role("fifth")
  val sixth = role("sixth")

  commonConfig(debugConfig(on = false).withFallback(
    ConfigFactory.parseString("""
      akka.cluster.failure-detector.monitored-by-nr-of-members = 2
      akka.cluster.auto-down-unreachable-after = 1s
      """)).
    withFallback(MultiNodeClusterSpec.clusterConfig))
}

class LeaderDowningAllOtherNodesMultiJvmNode1 extends LeaderDowningAllOtherNodesSpec
class LeaderDowningAllOtherNodesMultiJvmNode2 extends LeaderDowningAllOtherNodesSpec
class LeaderDowningAllOtherNodesMultiJvmNode3 extends LeaderDowningAllOtherNodesSpec
class LeaderDowningAllOtherNodesMultiJvmNode4 extends LeaderDowningAllOtherNodesSpec
class LeaderDowningAllOtherNodesMultiJvmNode5 extends LeaderDowningAllOtherNodesSpec
class LeaderDowningAllOtherNodesMultiJvmNode6 extends LeaderDowningAllOtherNodesSpec

abstract class LeaderDowningAllOtherNodesSpec
  extends MultiNodeSpec(LeaderDowningAllOtherNodesMultiJvmSpec)
  with MultiNodeClusterSpec {

  import LeaderDowningAllOtherNodesMultiJvmSpec._
  import ClusterEvent._

  "A cluster of 6 nodes with monitored-by-nr-of-members=2" must {
    "setup" taggedAs LongRunningTest in {
      // start some
      awaitClusterUp(roles: _*)
      enterBarrier("after-1")
    }

    "remove all shutdown nodes" taggedAs LongRunningTest in {
      val others = roles.drop(1)
      val shutdownAddresses = others.map(address).toSet
      enterBarrier("before-all-other-shutdown")
      runOn(first) {
        for (node ? others)
          testConductor.exit(node, 0).await
      }
      enterBarrier("all-other-shutdown")
      awaitMembersUp(numberOfMembers = 1, canNotBePartOfMemberRing = shutdownAddresses, 30.seconds)
    }

  }
} 
开发者ID:love1314sea,项目名称:akka-2.3.16,代码行数:60,代码来源:LeaderDowningAllOtherNodesSpec.scala

示例2: ClusterMetricsDisabledMultiJvmSpec

//设置package包名称以及导入依赖的类
package akka.cluster

import akka.remote.testkit.{ MultiNodeSpec, MultiNodeConfig }
import com.typesafe.config.ConfigFactory
import akka.testkit.LongRunningTest
import akka.cluster.ClusterEvent._

object ClusterMetricsDisabledMultiJvmSpec extends MultiNodeConfig {
  val first = role("first")
  val second = role("second")
  commonConfig(ConfigFactory.parseString("akka.cluster.metrics.enabled = off")
    .withFallback(MultiNodeClusterSpec.clusterConfigWithFailureDetectorPuppet))
}

class ClusterMetricsDisabledMultiJvmNode1 extends ClusterMetricsDisabledSpec
class ClusterMetricsDisabledMultiJvmNode2 extends ClusterMetricsDisabledSpec

abstract class ClusterMetricsDisabledSpec extends MultiNodeSpec(ClusterMetricsDisabledMultiJvmSpec) with MultiNodeClusterSpec {
  "Cluster metrics" must {
    "not collect metrics, not publish ClusterMetricsChanged, and not gossip metrics" taggedAs LongRunningTest in {
      awaitClusterUp(roles: _*)
      clusterView.clusterMetrics.size should be(0)
      cluster.subscribe(testActor, classOf[ClusterMetricsChanged])
      expectMsgType[CurrentClusterState]
      expectNoMsg
      clusterView.clusterMetrics.size should be(0)
      enterBarrier("after")
    }
  }
} 
开发者ID:love1314sea,项目名称:akka-2.3.16,代码行数:31,代码来源:ClusterMetricsDisabledSpec.scala

示例3: JoinInProgressMultiJvmSpec

//设置package包名称以及导入依赖的类
package akka.cluster

import com.typesafe.config.ConfigFactory
import org.scalatest.BeforeAndAfter
import akka.remote.testkit.MultiNodeConfig
import akka.remote.testkit.MultiNodeSpec
import akka.testkit._
import scala.concurrent.duration._

object JoinInProgressMultiJvmSpec extends MultiNodeConfig {
  val first = role("first")
  val second = role("second")

  commonConfig(
    debugConfig(on = false)
      .withFallback(ConfigFactory.parseString("""
          akka.cluster {
            # simulate delay in gossip by turning it off
            gossip-interval = 300 s
            failure-detector {
              threshold = 4
              acceptable-heartbeat-pause = 1 second
            }
          }""")
        .withFallback(MultiNodeClusterSpec.clusterConfig)))
}

class JoinInProgressMultiJvmNode1 extends JoinInProgressSpec
class JoinInProgressMultiJvmNode2 extends JoinInProgressSpec

abstract class JoinInProgressSpec
  extends MultiNodeSpec(JoinInProgressMultiJvmSpec)
  with MultiNodeClusterSpec {

  import JoinInProgressMultiJvmSpec._

  "A cluster node" must {
    "send heartbeats immediately when joining to avoid false failure detection due to delayed gossip" taggedAs LongRunningTest in {

      runOn(first) {
        startClusterNode()
      }

      enterBarrier("first-started")

      runOn(second) {
        cluster.join(first)
      }

      runOn(first) {
        val until = Deadline.now + 5.seconds
        while (!until.isOverdue) {
          Thread.sleep(200)
          cluster.failureDetector.isAvailable(second) should be(true)
        }
      }

      enterBarrier("after")
    }
  }
} 
开发者ID:love1314sea,项目名称:akka-2.3.16,代码行数:62,代码来源:JoinInProgressSpec.scala

示例4: NMembersAndSeed

//设置package包名称以及导入依赖的类
package csw.services.location.helpers

import akka.actor.ActorSystem
import akka.remote.testconductor.RoleName
import akka.remote.testkit.MultiNodeConfig
import com.typesafe.config.{Config, ConfigFactory}
import csw.services.location.commons.{ClusterAwareSettings, ClusterSettings}
import org.jboss.netty.logging.{InternalLoggerFactory, Slf4JLoggerFactory}

class NMembersAndSeed(n: Int) extends MultiNodeConfig {

  private val settings = ClusterAwareSettings

  // Fix to avoid 'java.util.concurrent.RejectedExecutionException: Worker has already been shutdown'
  InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory)

  def makeSystem(config: Config): ActorSystem = ActorSystem(settings.clusterName, config)

  val seed: RoleName = addRole("seed")(settings.onPort(3552))

  val members: Vector[RoleName] = (1 to n).toVector.map { x =>
    addRole(s"member-$x")(settings.joinLocal(3552))
  }

  commonConfig(ConfigFactory.parseString("akka.loggers = [csw.services.logging.compat.AkkaLogger]"))

  private def addRole(name: String)(settings: ClusterSettings): RoleName = {
    val node = role(name)
    nodeConfig(node)(settings.withEntries(sys.env).config)
    node
  }
}

class OneMemberAndSeed extends NMembersAndSeed(1) {
  val Vector(member) = members
}

class TwoMembersAndSeed extends NMembersAndSeed(2) {
  val Vector(member1, member2) = members
} 
开发者ID:tmtsoftware,项目名称:csw-prod,代码行数:41,代码来源:NMembersAndSeed.scala

示例5: MultiNodeIdGenerationTestConfig

//设置package包名称以及导入依赖的类
package org.tanukkii.reactive.snowflake

import akka.remote.testkit.MultiNodeConfig
import com.typesafe.config.ConfigFactory

object MultiNodeIdGenerationTestConfig extends MultiNodeConfig {
  val worker1_1 = role("worker-1-1")
  val worker1_2 = role("worker-1-2")
  val worker2_1 = role("worker-2-1")
  val worker2_2 = role("worker-2-2")

  commonConfig(ConfigFactory.parseString(
    """
      |akka.cluster.metrics.enabled=off
      |akka.actor.provider = "akka.cluster.ClusterActorRefProvider"
      |akka.loglevel = INFO
      |akka.persistence.journal.plugin = "akka.persistence.journal.inmem"
    """.stripMargin)
  )
} 
开发者ID:TanUkkii007,项目名称:reactive-snowflake,代码行数:21,代码来源:MultiNodeIdGenerationTestConfig.scala

示例6: MultiNodeRoleLeaderDownRolesSpecConfig

//设置package包名称以及导入依赖的类
package tanukki.akka.cluster.autodown

import akka.cluster.MultiNodeClusterSpec
import akka.remote.testkit.MultiNodeConfig
import com.typesafe.config.ConfigFactory


final case class MultiNodeRoleLeaderDownRolesSpecConfig(failureDetectorPuppet: Boolean) extends MultiNodeConfig {
  val node_A_1 = role("node-A-1")
  val node_A_2 = role("node-A-2")
  val node_A_3 = role("node-A-3")
  val node_B_1 = role("node-B-1")
  val node_B_2 = role("node-B-2")

  commonConfig(ConfigFactory.parseString(
    """
      |akka.cluster.downing-provider-class = "tanukki.akka.cluster.autodown.RoleLeaderAutoDowningRoles"
      |custom-downing {
      |  stable-after = 0s
      |  role-leader-auto-downing-roles {
      |    leader-role = "role-A"
      |    target-roles = [role-B]
      |  }
      |}
      |akka.cluster.metrics.enabled=off
      |akka.actor.warn-about-java-serializer-usage = off
      |akka.remote.log-remote-lifecycle-events = off
    """.stripMargin)
    .withFallback(MultiNodeClusterSpec.clusterConfig(failureDetectorPuppet))
  )

  nodeConfig(node_A_1, node_A_2, node_A_3)(ConfigFactory.parseString(
    """
      |akka.cluster {
      |  roles = [role-A]
      |}
    """.stripMargin))

  nodeConfig(node_B_1, node_B_2)(ConfigFactory.parseString(
    """
      |akka.cluster {
      |  roles = [role-B]
      |}
    """.stripMargin))

} 
开发者ID:TanUkkii007,项目名称:akka-cluster-custom-downing,代码行数:47,代码来源:MultiNodeRoleLeaderDownRolesSpecConfig.scala

示例7: MultiNodeQuorumLeaderAutoDownSpecConfig

//设置package包名称以及导入依赖的类
package tanukki.akka.cluster.autodown

import akka.cluster.MultiNodeClusterSpec
import akka.remote.testkit.MultiNodeConfig
import com.typesafe.config.ConfigFactory


final case class MultiNodeQuorumLeaderAutoDownSpecConfig(failureDetectorPuppet: Boolean) extends MultiNodeConfig {
  val nodeA = role("nodeA")
  val nodeB = role("nodeB")
  val nodeC = role("nodeC")
  val nodeD = role("nodeD")
  val nodeE = role("nodeE")

  commonConfig(ConfigFactory.parseString(
    """
      |akka.cluster.downing-provider-class = "tanukki.akka.cluster.autodown.QuorumLeaderAutoDowning"
      |custom-downing {
      |  stable-after = 1s
      |
      |  quorum-leader-auto-downing {
      |    role = "role"
      |    quorum-size = 3
      |    down-if-out-of-quorum = true
      |    shutdown-actor-system-on-resolution = false
      |  }
      |}
      |akka.cluster.metrics.enabled=off
      |akka.actor.warn-about-java-serializer-usage = off
      |akka.remote.log-remote-lifecycle-events = off
    """.stripMargin)
    .withFallback(MultiNodeClusterSpec.clusterConfig(failureDetectorPuppet))
  )

  nodeConfig(nodeA, nodeB, nodeC, nodeD, nodeE)(ConfigFactory.parseString(
    """
      |akka.cluster {
      |  roles = [role]
      |}
    """.stripMargin))

} 
开发者ID:TanUkkii007,项目名称:akka-cluster-custom-downing,代码行数:43,代码来源:MultiNodeQuorumLeaderAutoDownSpecConfig.scala

示例8: MultiNodeOldestAutoDownSpecConfig

//设置package包名称以及导入依赖的类
package tanukki.akka.cluster.autodown

import akka.cluster.MultiNodeClusterSpec
import akka.remote.testkit.MultiNodeConfig
import com.typesafe.config.ConfigFactory


final case class MultiNodeOldestAutoDownSpecConfig(failureDetectorPuppet: Boolean) extends MultiNodeConfig {
  val nodeA = role("nodeA")
  val nodeB = role("nodeB")
  val nodeC = role("nodeC")
  val nodeD = role("nodeD")
  val nodeE = role("nodeE")

  commonConfig(ConfigFactory.parseString(
    """
      |akka.cluster.downing-provider-class = "tanukki.akka.cluster.autodown.OldestAutoDowning"
      |custom-downing {
      |  stable-after = 1s
      |
      |  oldest-auto-downing {
      |    oldest-member-role = ""
      |    down-if-alone = true
      |    shutdown-actor-system-on-resolution = false
      |  }
      |}
      |akka.cluster.metrics.enabled=off
      |akka.actor.warn-about-java-serializer-usage = off
      |akka.remote.log-remote-lifecycle-events = off
    """.stripMargin)
    .withFallback(MultiNodeClusterSpec.clusterConfig(failureDetectorPuppet))
  )

  nodeConfig(nodeA, nodeB, nodeC, nodeD, nodeE)(ConfigFactory.parseString(
    """
      |akka.cluster {
      |  roles = [role]
      |}
    """.stripMargin))

} 
开发者ID:TanUkkii007,项目名称:akka-cluster-custom-downing,代码行数:42,代码来源:MultiNodeOldestAutoDownSpecConfig.scala

示例9: MultiNodeLeaderAutoDownRolesSpecConfig

//设置package包名称以及导入依赖的类
package tanukki.akka.cluster.autodown

import akka.cluster.MultiNodeClusterSpec
import akka.remote.testkit.MultiNodeConfig
import com.typesafe.config.ConfigFactory


final case class MultiNodeLeaderAutoDownRolesSpecConfig(failureDetectorPuppet: Boolean) extends MultiNodeConfig {
  val node_A_1 = role("node-A-1")
  val node_A_2 = role("node-A-2")
  val node_A_3 = role("node-A-3")
  val node_B_1 = role("node-B-1")

  commonConfig(ConfigFactory.parseString(
    """
      |akka.cluster.downing-provider-class = "tanukki.akka.cluster.autodown.LeaderAutoDowningRoles"
      |custom-downing {
      |  stable-after = 0s
      |
      |  leader-auto-downing-roles {
      |    target-roles = [role-A]
      |  }
      |}
      |akka.cluster.metrics.enabled=off
      |akka.actor.warn-about-java-serializer-usage = off
      |akka.remote.log-remote-lifecycle-events = off
    """.stripMargin)
    .withFallback(MultiNodeClusterSpec.clusterConfig(failureDetectorPuppet))
  )

  nodeConfig(node_A_1, node_A_2, node_A_3)(ConfigFactory.parseString(
    """
      |akka.cluster {
      |  roles = [role-A]
      |}
    """.stripMargin))

  nodeConfig(node_B_1)(ConfigFactory.parseString(
    """
      |akka.cluster {
      |  roles = [role-B]
      |}
    """.stripMargin))
} 
开发者ID:TanUkkii007,项目名称:akka-cluster-custom-downing,代码行数:45,代码来源:MultiNodeLeaderAutoDownRolesSpecConfig.scala

示例10: WordsClusterSpecConfig

//设置package包名称以及导入依赖的类
package aia.cluster
package words

import akka.remote.testkit.MultiNodeConfig
import com.typesafe.config.ConfigFactory

object WordsClusterSpecConfig extends MultiNodeConfig {
  val seed = role("seed")
  val master = role("master")
  val worker1 = role("worker-1")
  val worker2 = role("worker-2")

  commonConfig(ConfigFactory.parseString("""
    akka.actor.provider="akka.cluster.ClusterActorRefProvider"
    # don't use sigar for tests, native lib not in path
    akka.cluster.metrics.collector-class = akka.cluster.JmxMetricsCollector
                                         """))
} 
开发者ID:gilbutITbook,项目名称:006877,代码行数:19,代码来源:WordsClusterSpecConfig.scala

示例11: MultiNodeEC2MetadataReplicationTestConfig

//设置package包名称以及导入依赖的类
package tanukkii.akka.cluster.aws.ec2metadata

import akka.remote.testkit.MultiNodeConfig
import com.typesafe.config.ConfigFactory

object MultiNodeEC2MetadataReplicationTestConfig extends MultiNodeConfig {

  val node1 = role("node1")
  val node2 = role("node2")
  val node3 = role("node3")
  val node4 = role("node4")
  val node5 = role("node5")

  commonConfig(ConfigFactory.parseString(
    """
      |akka.cluster.metrics.enabled=off
      |akka.actor.provider = "akka.cluster.ClusterActorRefProvider"
      |akka.extensions += "akka.cluster.ddata.DistributedData"
      |akka.loglevel = INFO
    """.stripMargin))
} 
开发者ID:TanUkkii007,项目名称:akka-cluster-aws-ec2-metadata-replication,代码行数:22,代码来源:MultiNodeEC2MetadataReplicationTestConfig.scala

示例12: MultiNodeEC2MetadataReplicationTestConfig2

//设置package包名称以及导入依赖的类
package tanukkii.akka.cluster.aws.ec2metadata

import akka.remote.testkit.MultiNodeConfig
import com.typesafe.config.ConfigFactory

object MultiNodeEC2MetadataReplicationTestConfig2 extends MultiNodeConfig {

  val node1 = role("node1")
  val node2 = role("node2")
  val node3 = role("node3")
  val node4 = role("node4")
  val node5 = role("node5")

  commonConfig(ConfigFactory.parseString(
    """
      |akka.cluster.metrics.enabled=off
      |akka.actor.provider = "akka.cluster.ClusterActorRefProvider"
      |akka.extensions += "akka.cluster.ddata.DistributedData"
      |akka.extensions += "tanukkii.akka.cluster.aws.ec2metadata.EC2MetadataReplication"
      |akka.loglevel = INFO
      |akka-cluster-aws-ec2-metadata-replication {
      |  provide-instance-info-from-config = true
      |
      |  instance-info {
      |    instance-id = "i-12345"
      |    instance-type = "t2.micro"
      |    image-id = "ami-5fb8c835"
      |    architecture = "x86_64"
      |    kernel-id = "aki-919dcaf8"
      |    region = "us-east-1"
      |    availability-zone = "us-east-1d"
      |    private-ip = "10.158.112.5"
      |  }
      |}
    """.stripMargin))
} 
开发者ID:TanUkkii007,项目名称:akka-cluster-aws-ec2-metadata-replication,代码行数:37,代码来源:MultiNodeEC2MetadataReplicationTestConfig2.scala


注:本文中的akka.remote.testkit.MultiNodeConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。