• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Threads

 
Pavan Kumar Dittakavi
Ranch Hand
Posts: 106
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes that is possible. Just interrupt the thread and in the Runnable of the thread check if the thread is interrupted.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic