aspose file tools*
The moose likes Threads and Synchronization and the fly likes How to start ,suspend, resume Thread in java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "How to start ,suspend, resume Thread in java?" Watch "How to start ,suspend, resume Thread in java?" New topic
Author

How to start ,suspend, resume Thread in java?

Volodymyr Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 505
    
    1

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!


True person is moral, false is right!
Volodymyr Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 505
    
    1

Oops!

I am sorry, this saturday evening. Do not read that nonsense, I need a rest
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to start ,suspend, resume Thread in java?