//定时刷新
class Refures
{
//用于累加周期
long start = 0L;
long end = 0L;
//控制时钟周期
final long invet = 1000L*60*60L;
//这个运算可能要消耗1ms 忽略不计
boolean action()
{
//使用系统的计时器,永久有效。
start = System.currentTimeMillis();
if (start > end)
{
end = start + invet;
return true;
}
else
{
return false;
}
}
}
class YourInterface
{
static int callTimes = 0;
static Refures refures = new Refures();
//被调接口
static void youInterface()
{
//每1小时,就初始化一次
if (refures.action())
{
callTimes = 0;
}
callTimes++;
if (callTimes>=100)
{
return;
}
}
}