public class Timer
extends java.lang.Object
The standard java.util.Timer and java.util.TimerTask classes should be
considered deprecated because as described in "Java Concurrency in
Practice" by Brian Goetz on page 123, there are a few problems with
them. If an exception is thrown in the task then the entire Timer
stops running. And if a task takes a while then subsequent tasks
are not run at their appropriate time due to only a single thread
being used. Therefore should use ScheduledThreadPoolExecutor class
instead.
This is simply a convenient way of using a ScheduledThreadPoolExecutor.
Once gotten then can use the usual methods such as scheduleAtFixedRate()
- Author:
- SkiBu Smith