alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Akka/Scala example source code file (ClusterConfigSpec.scala)

This example Akka source code file (ClusterConfigSpec.scala) is included in my "Source Code Warehouse" project. The intent of this project is to help you more easily find Akka and Scala source code examples by using tags.

All credit for the original source code belongs to akka.io; I'm just trying to make examples easier to find. (For my Scala work, see my Scala examples and tutorials.)

Akka tags/keywords

akka, clustering, concurrent, failuredetectorimplementationclass, gossipinterval, metricscollectorclass, metricsenabled, metricsgossipinterval, minnrofmembersofrole, monitoredbynrofmembers, periodictasksinitialdelay, reducegossipdifferentviewprobability, remote, test, testing, time, usedispatcher

The ClusterConfigSpec.scala Akka example source code

/**
 * Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
 */

package akka.cluster

import language.postfixOps
import akka.testkit.AkkaSpec
import akka.dispatch.Dispatchers
import scala.concurrent.duration._
import akka.remote.PhiAccrualFailureDetector
import akka.util.Helpers.ConfigOps

@org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner])
class ClusterConfigSpec extends AkkaSpec {

  "Clustering" must {

    "be able to parse generic cluster config elements" in {
      val settings = new ClusterSettings(system.settings.config, system.name)
      import settings._
      LogInfo should be(true)
      FailureDetectorConfig.getDouble("threshold") should be(8.0 +- 0.0001)
      FailureDetectorConfig.getInt("max-sample-size") should be(1000)
      FailureDetectorConfig.getMillisDuration("min-std-deviation") should be(100 millis)
      FailureDetectorConfig.getMillisDuration("acceptable-heartbeat-pause") should be(3 seconds)
      FailureDetectorImplementationClass should be(classOf[PhiAccrualFailureDetector].getName)
      SeedNodes should be(Seq.empty[String])
      SeedNodeTimeout should be(5 seconds)
      RetryUnsuccessfulJoinAfter should be(10 seconds)
      PeriodicTasksInitialDelay should be(1 seconds)
      GossipInterval should be(1 second)
      GossipTimeToLive should be(2 seconds)
      HeartbeatInterval should be(1 second)
      MonitoredByNrOfMembers should be(5)
      HeartbeatExpectedResponseAfter should be(5 seconds)
      LeaderActionsInterval should be(1 second)
      UnreachableNodesReaperInterval should be(1 second)
      PublishStatsInterval should be(Duration.Undefined)
      AutoDownUnreachableAfter should be(Duration.Undefined)
      MinNrOfMembers should be(1)
      MinNrOfMembersOfRole should be(Map.empty)
      Roles should be(Set.empty)
      JmxEnabled should be(true)
      UseDispatcher should be(Dispatchers.DefaultDispatcherId)
      GossipDifferentViewProbability should be(0.8 +- 0.0001)
      ReduceGossipDifferentViewProbability should be(400)
      SchedulerTickDuration should be(33 millis)
      SchedulerTicksPerWheel should be(512)
      MetricsEnabled should be(true)
      MetricsCollectorClass should be(classOf[SigarMetricsCollector].getName)
      MetricsInterval should be(3 seconds)
      MetricsGossipInterval should be(3 seconds)
      MetricsMovingAverageHalfLife should be(12 seconds)
    }
  }
}

Other Akka source code examples

Here is a short list of links related to this Akka ClusterConfigSpec.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.