Try OpenEdge Now
skip to main content
Developing WebSpeed Applications
Controlling WebSpeed Transactions : Handling state-aware time-outs : Resetting a Web object's time-out period
 

Resetting a Web object's time-out period

Normally, when a Web object times-out, the timingOut event procedure runs and changes the object's state to "Timed-Out". To reset the time-out period after a state-aware Web object has timed-out, create a timing-out override to this event procedure using the Procedure Editor in the AppBuilder. In this local override procedure, call the setWebState function to make the Web object state-aware with a new time-out period.
To ensure that the Web object times-out at some point, allow the local override procedure to call the default timingOut procedure when your application no longer allows the time-out to be reset, as shown:
PROCEDURE timingOut :
/*------------------------------------------------------------------------
Purpose: Override standard ADM method
Notes:
------------------------------------------------------------------------*/
  /* Code placed here will execute PRIOR to standard behavior. */
/* Dispatch standard ADM method. */
IF get-user-field("Application-State") = "No-More-Changes" THEN
RUN SUPER.
ELSE
   setWebState (60).

/* Code placed here will execute AFTER standard behavior. */

END PROCEDURE.
In this example, the application must set the "Application-State" user field to "No-More-Changes" when it is ready to allow the time-out to proceed. Otherwise, when any time-out for this Web object occurs, it remains state-aware for another 60 minutes.
It is important to verify the code you use to conditionally execute the default timingOut procedure. If it never executes, the agent that is running the state-aware Web object remains locked because the time-out period is always reset. You can always force the object to time-out by running setWebState in the outputHeader procedure with a 0 time-out setting.