I'm not sure how the main program will know if the service is not running. Do I need to use a wait() notify() mechanism? How to ensure the program recovers after the exception.
Throwing an exception will not work -- as the exception thrown by one thread will not be caught by another thread.
You can however, setup some sort of communication between the two threads. It could be as simple as setting a flag, that is returned using a synchronized method -- which will be call right before the service is used. Or you can make it more notification driven, by using wait() and notify().
I recommend that you get a little deeper into threads -- if you want to use threads. The
Sun Thread Tutorial is a good place to start.
Henry