In form, you can call the setTimeout method of formrun to call a method on a regular basis. But how does one implement a common class instead of a form?
1. cache the current object in the global cache.
Server Static Void Main (ARGs _ ARGs)
{
Testclass= NewTestclass ();
Sysglobalcache=Infolog. globalcache ();
;
Cache.Set(Classstr (testclass ),"Hellotestclass", Testclass );
Testclass. testmethod ();
}
2. Call testmethod regularly using the addtimeout method of the infolog object Void Testmethod ()
{
;
This . Parmtimehandler (infolog. addtimeout ( This , Methodstr (testtimeout, testmethod ), 1000 , False ));
If (I = 10 )
Infolog. removetimeout ( This . Parmtimehandler ());
I ++ ;
Info (int2str (I ));
}
in this way, testmethod is called once every 1 s until the call reaches a specified number of times. The specific call is implemented through the calltimeout method of the info class, however, it is unknown when the calltimeout method is called.
definition of this class: class testclass extends Object
{< br> int timehanlder;
int I;
}
parmtimehandler method: int parmtimehandler ( int _ timehanlder = timehanlder)
{< br>;
timehanlder = _timehanlder;
return timehanlder;
}
because infolog is a client object, if the called method is a server object, it increases the number of interactions between the client and the server, but does not know how to implement regular calls on the server.