The following Function is executing in its own thread:
private void doSendData()
{
try {
//writeToFile(); // just a temporary location of a c
Maybe the method you are looking for is Thread.sleep(long)? This method will wait (as in stop the execution of the thread) for the specified time in milliseconds before resuming.
object.wait(long) (which is what you are using) does something entirely different. It waits for another object from another thread to notify it (ie: send it a sort of wakeup message), and will wait at most the specified number of milliseconds. Given the code you posted, I highly doubt this is what you really want.
If Thread.sleep() is not what you want, then you should use the synchronized block as mentioned by the other posters.