Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>The problem occur when while there's more than two active thread in system. the threads which are waiting won't wake up!</p> </blockquote> <p>Well how would you expect them to? You're only ever notifying the "current" object, which is a new thread. When one thread finishes, it will call <code>this.notifyAll</code>, but that won't wake up <em>other</em> threads.</p> <p>Additionally, I would <em>strongly</em> urge you to change other things about how you're writing this:</p> <ul> <li>An anonymous inner class of this size is crying out to be broken out into a proper named class</li> <li>The <code>ApplySetting</code> method name doesn't follow Java naming conventions. Ditto various of your variable names.</li> <li>It's generally a bad idea to extend <code>Thread</code> - implement <code>Runnable</code> instead, and pass the <code>Runnable</code> to the thread constructor</li> <li>You shouldn't call <code>wait</code> and <code>notify</code>/<code>notifyAll</code> on <code>Thread</code> objects, as <code>Thread</code> uses that for signalling itself</li> <li>It's generally a good idea to synchronize on private references which <em>no</em> other code is going to use for synchronization or signalling</li> <li>As noted in Marko's answer, it's almost always a bad idea to make the <code>run</code> method synchronized. Given the previous bullet point, I prefer not to make any whole <em>methods</em> synchronized, instead synchronizing on individual references within methods</li> <li>It looks like you're trying to update UI elements within a non-UI thread; I believe that will fail. (You need to use <code>invokeLater</code>)</li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload