Repository: spark Updated Branches: refs/heads/branch-1.0 3bd32f023 -> 1c12b0b5c
[SPARK-2409] Make SQLConf thread safe. Author: Reynold Xin <[email protected]> Closes #1334 from rxin/sqlConfThreadSafetuy and squashes the following commits: c1e0a5a [Reynold Xin] Fixed the duplicate comment. 7614372 [Reynold Xin] [SPARK-2409] Make SQLConf thread safe. (cherry picked from commit 32516f866a32d51bfaa04685ae77ba216b4202d9) Signed-off-by: Reynold Xin <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/1c12b0b5 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/1c12b0b5 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/1c12b0b5 Branch: refs/heads/branch-1.0 Commit: 1c12b0b5ca7cffa6fff4341ebc2823938601f71e Parents: 3bd32f0 Author: Reynold Xin <[email protected]> Authored: Tue Jul 8 14:00:47 2014 -0700 Committer: Reynold Xin <[email protected]> Committed: Tue Jul 8 14:01:14 2014 -0700 ---------------------------------------------------------------------- .../src/main/scala/org/apache/spark/sql/SQLConf.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/1c12b0b5/sql/core/src/main/scala/org/apache/spark/sql/SQLConf.scala ---------------------------------------------------------------------- diff --git a/sql/core/src/main/scala/org/apache/spark/sql/SQLConf.scala b/sql/core/src/main/scala/org/apache/spark/sql/SQLConf.scala index 64b9503..7c93de3 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/SQLConf.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/SQLConf.scala @@ -25,7 +25,9 @@ import scala.collection.JavaConverters._ * SQLConf holds mutable config parameters and hints. These can be set and * queried either by passing SET commands into Spark SQL's DSL * functions (sql(), hql(), etc.), or by programmatically using setters and - * getters of this class. This class is thread-safe. + * getters of this class. + * + * SQLConf is thread-safe (internally synchronized so safe to be used in multiple threads). */ trait SQLConf { @@ -54,11 +56,9 @@ trait SQLConf { Option(settings.get(key)).getOrElse(defaultValue) } - def getAll: Array[(String, String)] = settings.asScala.toArray + def getAll: Array[(String, String)] = settings.synchronized { settings.asScala.toArray } - def getOption(key: String): Option[String] = { - Option(settings.get(key)) - } + def getOption(key: String): Option[String] = Option(settings.get(key)) def contains(key: String): Boolean = settings.containsKey(key)
