|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object freemarker.template.cache.UpdateTimer
public final class UpdateTimer
A timer for objects that implement Updateable. Creates a new thread, in which it periodically calls the Updateable's update() method.
Uses techniques from the document "Why Are Thread.stop
,
Thread.suspend
, Thread.resume
and
Runtime.runFinalizersOnExit
Deprecated?", from the
Java API documentation.
Constructor Summary | |
---|---|
UpdateTimer(Updateable target,
long delay)
Constructs the timer with the update target and update interval. |
Method Summary | |
---|---|
void |
run()
Waits for the given period, then calls update() , if
required. |
void |
startTiming(int niceness)
Begins periodic automatic updates of the target. |
void |
stopTiming()
Stops (immediately) automatically updating the target. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UpdateTimer(Updateable target, long delay)
target
- the object to be updated.delay
- the number of milliseconds between updates.Method Detail |
---|
public void startTiming(int niceness)
niceness
- How much to decrease the priority of the timer thread
by. The value is applied against the default priority of the new
thread. The value may be negative, to indicate that the thread should
have a greater priority than the default.public void stopTiming()
public void run()
update()
, if
required. If someone decides to kill this thread, exit immediately.
run
in interface java.lang.Runnable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |