Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/3121#discussion_r19987089
--- Diff: core/src/main/scala/org/apache/spark/SparkContext.scala ---
@@ -1388,6 +1423,30 @@ class SparkContext(config: SparkConf) extends
SparkStatusAPI with Logging {
*/
object SparkContext extends Logging {
+ /**
+ * Lock that prevents multiple threads from being in the SparkContext
constructor at the same
+ * time.
+ */
+ private[spark] val SPARK_CONTEXT_CONSTRUCTOR_LOCK = new Object()
+
+ /**
+ * Records the creation site of the last SparkContext to successfully
enter the constructor.
+ * This may be an active SparkContext, or a SparkContext that is
currently under construction.
+ *
+ * Access to this field should be guarded by
SPARK_CONTEXT_CONSTRUCTOR_LOCK
+ */
+ private[spark] var activeSparkContextCreationSite: Option[CallSite] =
None
+
+ /**
+ * Tracks whether `activeSparkContextCreationSite` refers to a
fully-constructed SparkContext
+ * or a partially-constructed one that is either still executing its
constructor or threw
+ * an exception from its constructor. This is used to enable better
error-reporting when
+ * SparkContext construction fails due to existing contexts.
+ *
+ * Access to this field should be guarded by
SPARK_CONTEXT_CONSTRUCTOR_LOCK
+ */
+ private[spark] var activeSparkContextIsFullyConstructed: Boolean = false
--- End diff --
Personal preference, but the name is a little long. I'd prefer
`activeContextIsFullyConstructed`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]