I use a java.util.Timer to send ping singnals to some other applications which are connected to mine
by a standard socket communication. The timer's goal is to show communication problems soon.
Hence, if a connected application does not receive regular pings, it closes the socket after a certain
timeout and retries later. The timer's period is 2 seconds and the timeout at 30 seconds.
It happens (seldom but from time to time), that the timer is pausing for about some minutes (!)
and restarts by catching up all missing pings as a bunch. (The task is scheduled by the method
Of course, I know about the inaccuracies of Java's wait() method which seems to be the key line
in the Timer's implementation. But it's not a matter of some milliseconds but of minutes.
The operating system is Windows XP and the CPU usage is really low.
All threads (and there are just a dozen of them) have standard priority, which I would like to keep.
What could be the problem? And what could be a solution?
Thanks for any assistance.