Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated scala akka and curator dependency versions #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ organization := "com.sclasen"
name := "akka-zk-cluster-seed"
version := "0.1.11-SNAPSHOT"

scalaVersion := "2.12.4"
crossScalaVersions := Seq(scalaVersion.value, "2.11.11")
scalaVersion := "2.13.0"
crossScalaVersions := Seq(scalaVersion.value, "2.12.8", "2.11.12")

val akkaVersion = "2.5.9"
val akkaHttpVersion = "10.0.11"
val akkaVersion = "2.5.+"
val akkaHttpVersion = "10.1.+"

val akkaDependencies = Seq(
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
Expand All @@ -25,7 +25,7 @@ val exhibitorOptionalDependencies = Seq(
"com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpVersion
).map(_ % Provided)

val curatorVersion = "2.12.0"
val curatorVersion = "4.2.0"

val zkDependencies = Seq(
"curator-framework",
Expand All @@ -39,7 +39,7 @@ val testDependencies = Seq(
"com.typesafe.akka" %% "akka-testkit" % akkaVersion,
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-cluster" % akkaVersion,
"org.scalatest" %% "scalatest" % "3.0.1",
"org.scalatest" %% "scalatest" % "3.0.8",
"com.typesafe.akka" %% "akka-multi-node-testkit" % akkaVersion,
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"org.slf4j" % "log4j-over-slf4j" % "1.7.7",
Expand Down
7 changes: 2 additions & 5 deletions src/main/scala/akka/cluster/seed/ExhibitorClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package akka.cluster.seed

import java.security.cert.X509Certificate
import javax.net.ssl.{SSLContext, X509TrustManager}

import akka.actor.ActorSystem
import akka.http.scaladsl._
import akka.http.scaladsl.model.Uri.Path
Expand All @@ -12,10 +11,8 @@ import akka.util.{ByteString, Timeout}
import com.typesafe.sslconfig.akka.AkkaSSLConfig
import spray.json.DefaultJsonProtocol._
import spray.json.JsonParser

import scala.concurrent.duration._
import scala.concurrent.{ExecutionContext, ExecutionContextExecutor, Future}
import scala.language.postfixOps

case class ExhibitorClient(system: ActorSystem, exhibitorUrl: String, requestPath: String, validateCerts: Boolean) extends Client {

Expand Down Expand Up @@ -75,9 +72,9 @@ object SSL {

lazy val nonValidatingContext: SSLContext = {
class IgnoreX509TrustManager extends X509TrustManager {
def checkClientTrusted(chain: Array[X509Certificate], authType: String) {}
def checkClientTrusted(chain: Array[X509Certificate], authType: String):Unit = {}

def checkServerTrusted(chain: Array[X509Certificate], authType: String) {}
def checkServerTrusted(chain: Array[X509Certificate], authType: String): Unit = {}

def getAcceptedIssuers = null
}
Expand Down
8 changes: 3 additions & 5 deletions src/main/scala/akka/cluster/seed/ZookeeperClusterSeed.scala
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package akka.cluster.seed

import java.io.Closeable

import akka.actor._
import akka.cluster.{AkkaCuratorClient, AutoDownUnresolvedStrategies, Cluster, ZookeeperClusterSeedSettings}
import org.apache.curator.framework.CuratorFramework
import org.apache.curator.framework.recipes.cache.{PathChildrenCache, PathChildrenCacheEvent, PathChildrenCacheListener}
import org.apache.curator.framework.recipes.leader.{LeaderLatch, LeaderLatchListener}
import org.apache.curator.framework.state.{ConnectionState, ConnectionStateListener}
import org.apache.zookeeper.KeeperException.{NoNodeException, NodeExistsException}

import scala.annotation.tailrec
import scala.collection.JavaConverters._
import scala.collection.{immutable, mutable}
Expand Down Expand Up @@ -102,11 +100,11 @@ class ZookeeperClusterSeed(system: ExtendedActorSystem) extends Extension {
def waitForLeaderChange(times: Int, delay: Int)
(removedAddress: String): Either[Unit, Unit] =
latch.getLeader.getId.equals(removedAddress) match {
case false => Left(null)
case false => Left(())
case _ if times > 0 =>
Thread.sleep(delay)
waitForLeaderChange(times - 1, delay)(removedAddress)
case _ => Right(null)
case _ => Right(())
}

val pathCache = new PathChildrenCache(client, path, true)
Expand Down Expand Up @@ -206,7 +204,7 @@ class ZookeeperClusterSeed(system: ExtendedActorSystem) extends Extension {
}
}

private def createPathIfNeeded() {
private def createPathIfNeeded(): Unit = {
Option(client.checkExists().forPath(path)).getOrElse {
try {
client.create().creatingParentsIfNeeded().forPath(path)
Expand Down