Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5907#discussion_r29689099
  
    --- Diff: 
streaming/src/main/scala/org/apache/spark/streaming/StreamingContext.scala ---
    @@ -607,8 +614,27 @@ class StreamingContext private[streaming] (
      */
     
     object StreamingContext extends Logging {
    +  /**
    +   * Lock that guards access to global variables that track active 
StreamingContext.
    +   */
    +  private val ACTIVATION_LOCK = new Object()
     
    -  private[streaming] val DEFAULT_CLEANER_TTL = 3600
    +  private var activeContext: AtomicReference[StreamingContext] =
    +    new AtomicReference[StreamingContext](null)
    +
    +  private def assertNoOtherContextIsActive(): Unit = {
    +    ACTIVATION_LOCK.synchronized {
    +      if (activeContext.get() != null) {
    +        throw new SparkException("Only one StreamingContext may be started 
in this JVM")
    --- End diff --
    
    To clarify, we're allowed to start multiple StreamingContexts provided that 
only one context is running at a time, right?  Since that's the case, what do 
you think about rewording this to something like "Only one StreamingContext may 
be running in this JVM"?  I just worry that "started" might be misinterpreted 
as saying that you can only _create_ one SparkContext per JVM.
    
    We don't need to add an explicit test for starting a new StreamingContext 
after stopping the old one since this case is implicitly handled by all of our 
other test suites.


---
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]

Reply via email to