aspose file tools*
The moose likes Beginning Java and the fly likes Java Threads 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 » Beginning Java
Bookmark "Java Threads" Watch "Java Threads" New topic
Author

Java Threads

Pavan Kumar Dittakavi
Ranch Hand

Joined: Feb 12, 2011
Posts: 104

Hi Experts,

I have a small problem. I have 2 methods. MethodA and MethodB. If the user chooses to do someoperation on the UI, methodA will get called and finally methodB will get called and a thread is spawned from this methodB. But say suppose the control is in this thread spawned by methodB and the user selects som UI, then, the execution of thread of methodB should terminate instantly.

Is this possible. If yes, please provide me your views.

Thanks,
Pavan.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Yes that is possible. Just interrupt the thread and in the Runnable of the thread check if the thread is interrupted.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Threads