Hi,
I'm using Electroserver's scheduleExecution() method to send users a message every 30 seconds. The code runs as a server plugin, not a room plugin. It works great,... for 10 minutes only for any logged in users. After a user (client) has logged onto electroserver for 10 minutes, it stops receiving the message. That problem occurs everytime.
I'm using "-1" for numberOfTimes parameter, so theoretically it's infinite. And I haven't got a single line of cancelScheduledExecution() in my code. Any idea what the problem is?
Thanks.
Code:public class MyTimerPlugin extends BasePlugin { public static final String SERVERTIME = "SERVERTIME"; public static final int TIMERDURATION = 30000; // 30 seconds public static final int INFINITETIMES = -1; private EsObject message = new EsObject(); @Override public void init(EsObjectRO parameters) { getApi().getLogger().debug("Starting plugin " + getApi().getName()); this.helperSetUpTimer(); } // ---------------------------- // Set up a timer // ---------------------------- public void helperSetUpTimer() { getApi().scheduleExecution(TIMERDURATION, INFINITETIMES, new ScheduledCallback() { public void scheduledCallback() { java.util.Date now = new java.util.Date(); message.setNumber(SERVERTIME, now.getTime()); getApi().sendGlobalPluginMessage(message); } }); } }


Reply With Quote
