I'm in need of periodically (every 300 seconds) sending a status to an external system.
I can see that there is a TaskScheduler that I can access through the SmartFoxServer instance, but its not included in the documentation.
So question is, if I should use this class - and if there are some best practice examples anywhere?
My best guess is that the TaskScheduler is similar to the Java5+ scheduler functionality described here:
http://www.smartfoxserver.com/docs/inde ... _Java5.htm
But want to make sure that this is correct.
Thanks
/Thomas
[Solved] Usage of TaskScheduler?
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
Hmmm - for testing I tried to do the following:
And it seems to work - sort of. Its ignoring my 3 second timer and instead doing:
Quick math seems to have translated my 3 seconds into 75 seconds?!?!?!?!
/Thomas
Code: Select all
taskScheduler = SmartFoxServer.getInstance().getTaskScheduler();
taskScheduler.scheduleAtFixedRate(new SendServerStatusToMoodle(this), 0, 3, TimeUnit.SECONDS);
And it seems to work - sort of. Its ignoring my 3 second timer and instead doing:
Code: Select all
16:15:52,640 INFO [pool-2-thread-1] Extensions - {__lib__}: Sending server status
16:17:07,768 INFO [pool-2-thread-1] Extensions - {__lib__}: Sending server status
16:18:22,785 INFO [pool-2-thread-1] Extensions - {__lib__}: Sending server status
16:19:37,801 INFO [pool-2-thread-1] Extensions - {__lib__}: Sending server status
Quick math seems to have translated my 3 seconds into 75 seconds?!?!?!?!
/Thomas
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
Who is online
Users browsing this forum: No registered users and 132 guests