long now = SystemTime.getCurrentTime();
boolean run_it = false;
synchronized( this ){
long delay = min_millis - (now - last_run );
if ( now < last_run || delay <= 0 ){
last_run = now;
run_it = true;
}else{
// run too recently
if ( delay_event == null ){
delay_event =
new DelayedEvent(
"FreqLimDisp",
delay,
new AERunnable()
{
public void
runSupport()
{
long now = SystemTime.getCurrentTime();
synchronized( this ){
last_run = now;
delay_event = null;
}
target.run();
}
});
}
}
}
if ( run_it ){
target.run();
}