3. Timers
• What is a timer?
A timer is an "internal time clock" that you programmatically create
to perform an action each time the timer expires.
• Built-ins used:
– FIND_TIMER
– CREATE_TIMER
– SET_TIMER
– DELETE_TIMER
– GET_APPLICATION_PROPERTY
(TIMER_NAME)
http://blog.ebiztechnics.com
4. Usage of Timers
• WHEN-TIMER-EXPIRED Trigger.
• Using timers:
– Periodically query, commit, or rollback
– Show “About…” information at startup
– Display ticker messages
– Display running time
http://blog.ebiztechnics.com
8. Delete Timer
• Syntax:
DELETE_TIMER (timer_name)
DELETE_TIMER (timer_id)
...
IF NOT ID_NULL (FIND_TIMER (‘Time1’)) THEN
DELETE_TIMER (’Time1’);
END IF;
...
http://blog.ebiztechnics.com
9. Find Timer Expiration
• Example:
IF GET_APPLICATION_PROPERTY(TIMER_NAME)=‘Time1’
THEN
Select . . . . .
From t1;
ELSE
:control.time_disp:=:SYSTEM.CURRENT_DATETIME;
END IF;
http://blog.ebiztechnics.com
10. Summary
• Create and modify a timer with built-in
functions
– FIND_TIMER
– CREATE_TIMER
– SET_TIMER
– DELETE_TIMER
– GET_APPLICATION_PROPERTY
(TIMER_NAME)
http://blog.ebiztechnics.com
Notas del editor
Technical Note
Timers are not suitable means of shutting down an application. It is the job of
The operating system to recognize idle process and shut them down.
Web Design Tip
You should restrict the frequency of timers in Web-Deployed forms in order
To reduce a potential increase in network traffic. Replacing timers with
JavaBeans, which provide similar functionality, will benefit users as code
Would be executed on the Web client without invoking network traffic.