My question : How can i prevent overlapping of timer intervals.Which I do not the second interval to start if there is a thread from the first interval still running.
A Timer is single threaded -- which means the timer will not be able to call the repeated task again til the previous call finishes. If your timer task performs a join() of the three threads that it starts, the timer will not be able to call the task again, until the three threads finish.
What henry told is perfect. Actually, creating 3 new threads every time the scheduled task is executed, does not look like a good choice. You can use a thread pool instead and restrict the maximum size to 3. If you are using jdk 5 then, instead of timer you can use a ScheduledThreadPoolExecutor that extends the features of a Timer to provide a thread pool also. [ September 18, 2007: Message edited by: Nitesh Kant ]