Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to start ,suspend, resume Thread in java?

 
Volodymyr Lysenko
Ranch Hand
Posts: 512
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

This is merely impossible to bear. I do not know Java Threads at all. What is that?

Here is my primitive Thread:

As you see it is simple. Here is my code that starts thread :

This method creates SplashTooltipThread and executes run method once, then run sets isRunning to false(line 13) to stop executing run method.

However when I again call this method(sleepAndShowTooltip) I do not create SplashTooltipThread but instead I only set its variable isRunning to true. I expect that my SplashTooltipThread will again execute method run once. But it never happens. I print that splashTooltipThread.isRunning is true but splashTooltipThread does not execute its run method again.

What happened to while loop inside run method and why it does not see that I set back isRuning to true.

Thank you!
 
Volodymyr Lysenko
Ranch Hand
Posts: 512
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops!

I am sorry, this saturday evening. Do not read that nonsense, I need a rest
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic