aspose file tools*
The moose likes Threads and Synchronization and the fly likes Exception with the Piece of Code 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 "Exception with the Piece of Code" Watch "Exception with the Piece of Code" New topic
Author

Exception with the Piece of Code

buntha Choudhary
Ranch Hand

Joined: Jul 03, 2009
Posts: 136

I am a beginner in Multithreading and I have an issue with my very first Program. In the code given below, after Clicking START Button, thread starts to run and prints the label on the panel ,and On clicking STOP , it stops , but again when I click on START button , it is throwing IllegalThreadStateException, moreover if I use interrupt() in Stop , it is not stopping or nothing is happening in the code.


Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
Thread interrupt is not working the way you would expect it to.

Google for Java How to Interrupt a Thread


JDBCSupport - An easy to use, light-weight JDBC framework -
buntha Choudhary
Ranch Hand

Joined: Jul 03, 2009
Posts: 136

Thanks for Thread Interrupt issue , but why the START button is throwing exception ?
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
Because you cannot start a Thread twice.
buntha Choudhary
Ranch Hand

Joined: Jul 03, 2009
Posts: 136

there are 2 commands called suspend and resume but those are depreciated , so is there no way to get my desired output?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception with the Piece of Code