I'm trying to set an AbstractAjaxTimerBehavior to start immediately when called and then be repeated every X seconds (let's say 10 seconds), but i couldn't find something. I thought of a hack by setting the first interval to 1 second and then inside onTimer method, set every time the interval to the desired X seconds.
myBehavior = new AbstractAjaxTimerBehavior(Duration.seconds(1)) {
private static final long serialVersionUID = 1L;
@Override
protected void onTimer(AjaxRequestTarget target) {
this.setUpdateInterval(Duration.seconds(10));
.
.
.
}
}
Is there a better way of doing that without having to set every time the interval inside onTimer? Thnx!