This week's giveaway is in the Threads forum.
We're giving away four copies of Java Concurrency Live Lessons and have Doug Schmidt on-line!
See this thread for details.
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

PropertyChange fires twice after task is cancelled  RSS feed

 
Eric Juneau
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a task that can get cancelled right away if some parameters are null. If this is so, the task is cancelled, and in propertyChange method, a JOptionPane comes up with a warning. However, it seems that the app is running so fast that the propertychange method is run twice, so two JOptionPanes appear with the same information. If I put in a time-wasting loop before the task is cancelled (ex. for(int i=0;i<10000;ii++){ System.out.println("");}), the propertyChange method is called only once. Is there something I'm doing wrong?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!