From 2c9e013ce5e49ed13a5fb158c3b3a0a139074617 Mon Sep 17 00:00:00 2001 From: Nafer Sanabria Date: Sun, 12 Feb 2017 16:40:12 -0500 Subject: [PATCH] Upgrade Typesafe Config & slf4j --- .../main/scala/akka/actor/ActorSystem.scala | 19 +++++++++---------- .../scala/akka/dispatch/CachingConfig.scala | 6 ++++++ project/Dependencies.scala | 9 +++++---- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/akka-actor/src/main/scala/akka/actor/ActorSystem.scala b/akka-actor/src/main/scala/akka/actor/ActorSystem.scala index d46825af38..e5f686ade4 100644 --- a/akka-actor/src/main/scala/akka/actor/ActorSystem.scala +++ b/akka-actor/src/main/scala/akka/actor/ActorSystem.scala @@ -18,8 +18,7 @@ import akka.util.Helpers.toRootLowerCase import scala.annotation.tailrec import scala.collection.immutable -import scala.concurrent.duration.Duration -import scala.concurrent.{ Await, ExecutionContext, ExecutionContextExecutor, Future, Promise } +import scala.concurrent.{ ExecutionContext, ExecutionContextExecutor, Future, Promise } import scala.util.{ Failure, Success, Try } import scala.util.control.{ ControlThrowable, NonFatal } import java.util.Optional @@ -186,14 +185,14 @@ object ActorSystem { * then tries to walk the stack to find the callers class loader, then falls back to the ClassLoader * associated with the ActorSystem class. * - * @see The Typesafe Config Library API Documentation + * @see The Typesafe Config Library API Documentation */ def create(name: String, config: Config): ActorSystem = apply(name, config) /** * Creates a new ActorSystem with the specified name, the specified Config, and specified ClassLoader * - * @see The Typesafe Config Library API Documentation + * @see The Typesafe Config Library API Documentation */ def create(name: String, config: Config, classLoader: ClassLoader): ActorSystem = apply(name, config, classLoader) @@ -210,7 +209,7 @@ object ActorSystem { * executor = "default-executor", including those that have not defined the executor setting and thereby fallback * to the default of "default-dispatcher.executor". * - * @see The Typesafe Config Library API Documentation + * @see The Typesafe Config Library API Documentation */ def create(name: String, config: Config, classLoader: ClassLoader, defaultExecutionContext: ExecutionContext): ActorSystem = apply(name, Option(config), Option(classLoader), Option(defaultExecutionContext)) @@ -258,14 +257,14 @@ object ActorSystem { * then tries to walk the stack to find the callers class loader, then falls back to the ClassLoader * associated with the ActorSystem class. * - * @see The Typesafe Config Library API Documentation + * @see The Typesafe Config Library API Documentation */ def apply(name: String, config: Config): ActorSystem = apply(name, Option(config), None, None) /** * Creates a new ActorSystem with the specified name, the specified Config, and specified ClassLoader * - * @see The Typesafe Config Library API Documentation + * @see The Typesafe Config Library API Documentation */ def apply(name: String, config: Config, classLoader: ClassLoader): ActorSystem = apply(name, Option(config), Option(classLoader), None) @@ -278,7 +277,7 @@ object ActorSystem { * If no ExecutionContext is given, the system will fallback to the executor configured under "akka.actor.default-dispatcher.default-executor.fallback". * The system will use the passed in config, or falls back to the default reference configuration using the ClassLoader. * - * @see The Typesafe Config Library API Documentation + * @see The Typesafe Config Library API Documentation */ def apply( name: String, @@ -292,7 +291,7 @@ object ActorSystem { * * For more detailed information about the different possible configuration options, look in the Akka Documentation under "Configuration" * - * @see The Typesafe Config Library API Documentation + * @see The Typesafe Config Library API Documentation */ class Settings(classLoader: ClassLoader, cfg: Config, final val name: String, val setup: ActorSystemSetup) { @@ -301,7 +300,7 @@ object ActorSystem { /** * The backing Config of this ActorSystem's Settings * - * @see The Typesafe Config Library API Documentation + * @see The Typesafe Config Library API Documentation */ final val config: Config = { val config = cfg.withFallback(ConfigFactory.defaultReference(classLoader)) diff --git a/akka-actor/src/main/scala/akka/dispatch/CachingConfig.scala b/akka-actor/src/main/scala/akka/dispatch/CachingConfig.scala index edd7db9ea9..345c7d721a 100644 --- a/akka-actor/src/main/scala/akka/dispatch/CachingConfig.scala +++ b/akka-actor/src/main/scala/akka/dispatch/CachingConfig.scala @@ -4,6 +4,7 @@ package akka.dispatch +import java.util import java.util.concurrent.{ ConcurrentHashMap, TimeUnit } import com.typesafe.config._ @@ -191,5 +192,10 @@ private[akka] class CachingConfig(_config: Config) extends Config { def resolveWith(source: Config, options: ConfigResolveOptions) = config.resolveWith(source, options) def resolveWith(source: Config) = config.resolveWith(source) + + override def getEnumList[T <: Enum[T]](enumClass: Class[T], path: String): util.List[T] = config.getEnumList(enumClass, path) + + override def getEnum[T <: Enum[T]](enumClass: Class[T], path: String): T = config.getEnum(enumClass, path) + } diff --git a/project/Dependencies.scala b/project/Dependencies.scala index d16ae026a5..cb9e662e4d 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -15,6 +15,7 @@ object Dependencies { lazy val java8CompatVersion = settingKey[String]("The version of scala-java8-compat to use.") val junitVersion = "4.12" val sslConfigVersion = "0.2.1" + val slf4jVersion = "1.7.22" val Versions = Seq( crossScalaVersions := Seq("2.11.8", "2.12.1"), @@ -39,14 +40,14 @@ object Dependencies { val camelCore = "org.apache.camel" % "camel-core" % "2.13.4" exclude("org.slf4j", "slf4j-api") // ApacheV2 // when updating config version, update links ActorSystem ScalaDoc to link to the updated version - val config = "com.typesafe" % "config" % "1.3.0" // ApacheV2 + val config = "com.typesafe" % "config" % "1.3.1" // ApacheV2 val netty = "io.netty" % "netty" % "3.10.6.Final" // ApacheV2 val scalaStm = Def.setting { "org.scala-stm" %% "scala-stm" % scalaStmVersion.value } // Modified BSD (Scala) val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.0.5" // Scala License val scalaReflect = ScalaVersionDependentModuleID.versioned("org.scala-lang" % "scala-reflect" % _) // Scala License - val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.16" // MIT + val slf4jApi = "org.slf4j" % "slf4j-api" % slf4jVersion // MIT // mirrored in OSGi sample val osgiCore = "org.osgi" % "org.osgi.core" % "4.3.1" // ApacheV2 @@ -103,8 +104,8 @@ object Dependencies { val metricsAll = Seq(metrics, metricsJvm, latencyUtils, hdrHistogram) // sigar logging - val slf4jJul = "org.slf4j" % "jul-to-slf4j" % "1.7.16" % "test" // MIT - val slf4jLog4j = "org.slf4j" % "log4j-over-slf4j" % "1.7.16" % "test" // MIT + val slf4jJul = "org.slf4j" % "jul-to-slf4j" % slf4jVersion % "test" // MIT + val slf4jLog4j = "org.slf4j" % "log4j-over-slf4j" % slf4jVersion % "test" // MIT // reactive streams tck val reactiveStreamsTck = "org.reactivestreams" % "reactive-streams-tck" % "1.0.0" % "test" // CC0