yogessh chavaan wrote:
in my parent process's constructor i start a child thread.
As Anayonkar points out, that is a parent
thread, not a parent process.
but while this is running and i start the parent again i get address already bind exception(as the parent is connecting to a port) and the 2nd parent exits.but the child thread started with the second parent doesn't exit.
Yes, as I suggested initially, use setDaemon().
If you do this:
then main() can end but your
java process keeps running. The JVM doesn't automatically die when main ends.
So, like I said, check out Thread.setDaemon().
thanks.