001 package javax.realtime; 002 003 /** A timed <code>AsyncEvent</code> that is driven by a clock. It will 004 * fire off once, when the clock time reaches the timeout time. If the 005 * clock time has already passed the timeout time, it will fire 006 * immediately. 007 */ 008 public class OneShotTimer extends Timer { 009 010 /** Create an instance of <code>AsyncEvent</code> that will execute 011 * its fire method at the expiration of the given time. 012 * 013 * @param time After timeout <code>time</code> units from 'now' 014 * fire will be executed. 015 * @param handler The <code>AsyncEventHandler</code> that will be 016 * scheduled when fire is executed. 017 */ 018 public OneShotTimer(HighResolutionTime time, 019 AsyncEventHandler handler) { 020 super(time, Clock.getRealtimeClock(), handler); 021 } 022 023 /** Create an instance of <code>AsyncEvent</code>, based on the 024 * given clock, that will execute its fire method at the expiration 025 * of the given time. 026 * 027 * @param start Start time for timer. 028 * @param clock The timer will increment based on this clock. 029 * @param handler The <code>AsyncEventHandler</code> that will be 030 * scheduled when fire is executed. 031 */ 032 public OneShotTimer(HighResolutionTime start, Clock clock, 033 AsyncEventHandler handler) { 034 super(start, clock, handler); 035 } 036 }