This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def refreshWorkers() { | |
val cs = clusterService.clusterStatus | |
for (participant <- cs.participants) { | |
val path = if (cs.current == participant) | |
akkaConfig.localActorPath(workerPath) | |
else | |
remotePathForParticipant( | |
akkaConfig, participant, workerPath) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait ClusterService { | |
def initialize() | |
def enabled: Boolean | |
def clusterStatus: ClusterStatus | |
} | |
case class ClusterStatus( | |
current: String, | |
isLeader: Boolean, leader: String, | |
participants: Iterable[String]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Value("${deliveryService.distributeSchedule:0,30 * * * * *}") | |
var distributeSchedule: String = _ | |
schedulerService.addJob( | |
SchedulerJob("distributeEvents", () => scheduledDistribute(), distributeSchedule)) | |
def scheduledDistribute() = | |
if (clusterService.clusterStatus.isLeader) | |
distribute() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original leader (localhost:14181): | |
16:11:18.002 [ForkJoinPool-1-worker-9] DEBUG c.n.s.n.DeliveryService$DeliverySerializer - received SerializedDelivery: none | |
16:11:18.002 [ForkJoinPool-1-worker-9] DEBUG c.n.s.n.DeliveryServiceImpl - delivering noDigest events | |
16:11:18.128 [main-EventThread] INFO c.nyx.services.ZookeeperServiceImpl - watchedEvent: eventType=NodeChildrenChanged state=SyncConnected | |
16:11:18.139 [main-EventThread] INFO c.nyx.services.ZookeeperServiceImpl - nodeId=localhost:14181 isLeader=true, Cluster participants: localhost:14181, localhost:14185, leader=localhost:14181 | |
16:11:18.250 [main-EventThread] INFO c.nyx.services.ZookeeperServiceImpl - watchedEvent: eventType=None state=Disconnected | |
16:11:24.498 [main-EventThread] INFO c.nyx.services.ZookeeperServiceImpl - nodeId=localhost:14181 isLeader=true, Cluster participants: localhost:14181, localhost:14185, leader=localhost:14181 | |
16:11:24.500 [main-EventThread] INFO c.nyx.services.ZookeeperServiceImpl - watchedEvent: eventType=None state= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is localhost:14181 - the original leader | |
20:45:43.175 [RMI TCP Connection(2)-127.0.0.1-EventThread] INFO c.nyx.services.ZookeeperServiceImpl - nodeId=localhost:14181 hasLeadership=true, Cluster participants: localhost:14181, localhost:14189, leader=localhost:14181 | |
20:46:00.017 [ThreadPoolTaskScheduler-1] ERROR com.netflix.curator.ConnectionState - Connection timed out for connection string (localhost:14181,localhost:14185,localhost:14189) and timeout (15000) / elapsed (16724) | |
org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss | |
at com.netflix.curator.ConnectionState.getZooKeeper(ConnectionState.java:94) ~[curator-client-1.2.3.jar:na] | |
at com.netflix.curator.CuratorZookeeperClient.getZooKeeper(CuratorZookeeperClient.java:105) [curator-client-1.2.3.jar:na] | |
at com.netflix.curator.framework.imps.CuratorFrameworkImpl.getZooKeeper(CuratorFrameworkImpl.java:410) [curator-framework-1.2.3.jar:na] | |
at com.netflix.curator.framework.imps.GetChildrenBuilderImpl$3.call(Ge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait ClusterService { | |
def initialize() | |
def enabled: Boolean | |
def clusterStatus: ClusterStatus | |
def nodeId: String | |
} | |
case class ClusterStatus( | |
current: String, | |
isLeader: Boolean, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val participants = clusterService.clusterStatus.participants | |
val workers = participants.map(nodeIdToActorRef(_)) | |
workers.foreach(_ ! nextWork()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ZookeeperService(hostInfo: HostInfo) | |
extends ClusterService with EmbeddedZookeeper { | |
def nodeId: String = hostInfo.hostname + ":" + hostInfo.basePort + 1 | |
@Value("${zookeeperService.client.enabled:false}") | |
var enabled: Boolean = _ | |
@Value("${zookeeperService.leaderPath:/ls}") | |
var leaderPath: String = _ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sbt._ | |
import Keys._ | |
import com.typesafe.sbt.SbtMultiJvm | |
import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys.{ MultiJvm } | |
object ExampleBuild extends Build { | |
lazy val buildSettings = Defaults.defaultSettings ++ multiJvmSettings ++ Seq( | |
organization := "example", | |
version := "1.0", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.Source | |
import java.io.{FileInputStream, InputStream} | |
import com.typesafe.config.{ConfigException, Config, ConfigFactory} | |
import com.foo.dbfs.{FileSystem, Factory} | |
import com.foo.util.Logging | |
import com.foo.util.Environment | |
/** | |
* CslConfig manages CSL Configuration. | |
* |