Re: Detecting whether a certain thread is running or not.
Wednesday, March 20, 2002 07:43 AM
Do you mean that you start a *process*? When the first JVM exits, any threads created by it will be destroyed, so any programs that follow this event can safely assume that the first thread is no longer running.
As for inter-JVM communication about the existence of a particular thread ( or process ), there are many ways to do it. You basically need some kind of shared resource which any JVM can read from and modify. When the first thread is started, modify this shared resource to indicate this fact. Other JVMs that are started then check this resource's state before performing any action.
In a robust system, this shared resource would be a database, a JMS topic, etc, but you could do it quickly with a File in a well-known location.
Hope this helps.