In the above code, I started a thread to wait for sometime before it shuts down this process, by that time, returning the "shutdown success" String. Seems like the thread start is happening before the return line. So, the system.exit(0) is happening before I can send out the return value. My idea of having a synchronized block in run method that object has to perform the return before running the synchronized block in the run method of the kill thread. Does not seem to help. Any suggestions as to how I can send the return value before exiting the program ? Thanks -Bindu [Added CODE tags - PdH] [ February 08, 2002: Message edited by: Peter den Haan ]
Bindu Dharmavaram
Greenhorn
Joined: May 23, 2001
Posts: 9
posted
0
To add on, Actually, the method shutdown is synchronized too. So, by having another synchronized block within run method of the thread should complete the return statement, and then run the thread inside the inner block. The process, which is listening on the return variable from this method is timing out not able to receive that return string. Hence, I think that the System.exit(0) in the run method is somehow executed before the return statement. Is this normal behavior ?