// execute once
updateUI(new RequestHandler() {
@Override
public void onRequest() {
PScheduler.get().scheduleFixedDelay(new RepeatingCommand() {
@Override
public boolean execute() {
eventsListener.stackCommandResult(new PTestEvent(this, "Timer execution 1"));
return false;
}
}, 50);
}
});
final PTestEvent e1 = eventsListener.poll();
Assert.assertEquals("Timer execution 1", e1.getBusinessMessage());
// execute 3 times
final AtomicInteger count = new AtomicInteger(0);
updateUI(new RequestHandler() {
@Override
public void onRequest() {
PScheduler.get().scheduleFixedDelay(new RepeatingCommand() {
@Override
public boolean execute() {
final int ct = count.incrementAndGet();
eventsListener.stackCommandResult(new PTestEvent(this, "Repeating timer execution " + ct));