Java TV(tm) API 1.0

javax.tv.util
Class TVTimer

java.lang.Object
  |
  +--javax.tv.util.TVTimer

public abstract class TVTimer
extends java.lang.Object

A class representing a timer. A timer is responsible for managing a set of timer events specified by timer specifications. When the timer event should be sent, the timer calls the timer specification's notifyListeners() method.

See Also:
TVTimerSpec

Constructor Summary
TVTimer()
          Constructs a TVTimer object.
 
Method Summary
abstract  void deschedule(TVTimerSpec t)
          Removes a timer specification from the set of monitored specifications.
abstract  long getGranularity()
          Report the granularity of this timer, i.e., the length of time between "ticks" of this timer.
abstract  long getMinRepeatInterval()
          Report the minimum interval that this timer can repeat tasks.
static TVTimer getTimer()
          Returns the default timer for the system.
abstract  TVTimerSpec scheduleTimerSpec(TVTimerSpec t)
          Begins monitoring a TVTimerSpec.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TVTimer

public TVTimer()
Constructs a TVTimer object.
Method Detail

getTimer

public static TVTimer getTimer()
Returns the default timer for the system. There may be one TVTimer instance per virtual machine, one per applet, one per call to getTimer(), or some other platform dependent implementation.
Returns:
A non-null TVTimer object.

scheduleTimerSpec

public abstract TVTimerSpec scheduleTimerSpec(TVTimerSpec t)
                                       throws TVTimerScheduleFailedException
Begins monitoring a TVTimerSpec.

When the timer specification should go off, the timer will call TVTimerSpec.notifyListeners().

Returns the actual TVTimerSpec that got scheduled. If you schedule a specification that implies a smaller granularity than this timer can provide, or a repeat timer specification that has a smaller repeating interval than this timer can provide, the timer should round to the closest value and return that value as a TVTimerSpec object. An interested application can use accessor methods getMinRepeatInterval() and getGranularity() to obtain the Timer's best knowledge of the Timer's limitation on granularity and repeat interval. If you schedule an absolute specification that should have gone off already, it will go off immediately. If the scheduled specification cannot be satisfied, the exception TVTimerScheduleFailedException should be thrown.

You may schedule a timer specification with multiple timers. You may schedule a timer specification with the same timer multiple times (in which case it will go off multiple times). If you modify a timer specification after it has been scheduled with any timer, the results are unspecified.

Parameters:
t - The timer specification to begin monitoring.
Returns:
The real TVTimerSpec that was scheduled.
Throws:
TVTimerScheduleFailedException - is thrown when the scheduled specification cannot be satisfied.

deschedule

public abstract void deschedule(TVTimerSpec t)
Removes a timer specification from the set of monitored specifications. The descheduling happens as soon as practical, but may not happen immediately. If the timer specification has been scheduled multiple times with this timer, all the schedulings are canceled.
Parameters:
t - The timer specification to end monitoring.

getMinRepeatInterval

public abstract long getMinRepeatInterval()
Report the minimum interval that this timer can repeat tasks. For example, it's perfectly reasonable for a Timer to specify that the minimum interval for a repeatedly performed task is 1000 milliseconds between every run. This is to avoid possible system overloading.
Returns:
The timer's best knowledge of minimum repeat interval in milliseconds. Return -1 if this timer doesn't know its repeating interval limitation.

getGranularity

public abstract long getGranularity()
Report the granularity of this timer, i.e., the length of time between "ticks" of this timer.
Returns:
The timer's best knowledge of the granularity in milliseconds. Return -1 if this timer doesn't know its granularity.

Java TV(tm) API 1.0

Copyright © 1998 - 2000 Sun Microsystems, Inc.