aspose file tools*
The moose likes Threads and Synchronization and the fly likes Not able to stop execution Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Not able to stop execution" Watch "Not able to stop execution" New topic
Author

Not able to stop execution

Happy S Singh
Ranch Hand

Joined: Nov 14, 2011
Posts: 55
I am not able to stop the execution of the thread.I want to stop the execution while it is executing or on the button click event based on the thread id passed. I am trying below code


Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

The key here is what happens in upload(). Setting the finished flag does not stop upload() from executing, it just prevents it from running again. If you want to make sure upload() stops before it completes there needs to be some way to interrupt the execution of that code. Since you don't show that code it is hard to say how you should do that.


Steve
Happy S Singh
Ranch Hand

Joined: Nov 14, 2011
Posts: 55

My whole class with upload method.Guide me

Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18962
    
  40

Happy S Singh wrote:
My whole class with upload method.Guide me



Steve gave you the answer -- and even a direction on making it do what you want.

Ignoring the answer, and dumping more code (that doesn't add to the topic) is not really very useful here.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Not able to stop execution