Repository: spark Updated Branches: refs/heads/master b520b6453 -> 32516f866
[SPARK-2409] Make SQLConf thread safe. Author: Reynold Xin <r...@apache.org> 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. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/32516f86 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/32516f86 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/32516f86 Branch: refs/heads/master Commit: 32516f866a32d51bfaa04685ae77ba216b4202d9 Parents: b520b64 Author: Reynold Xin <r...@apache.org> Authored: Tue Jul 8 14:00:47 2014 -0700 Committer: Reynold Xin <r...@apache.org> Committed: Tue Jul 8 14:00:47 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/32516f86/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 95ed0f2..b6fb46a 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 { @@ -71,11 +73,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)