[Solved] Usage of TaskScheduler?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

[Solved] Usage of TaskScheduler?

Postby ThomasLund » 27 Oct 2010, 12:42

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
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 27 Oct 2010, 13:00

Hmmm - for testing I tried to do the following:

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
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 28 Oct 2010, 07:44

Where you able to understand what's going on? Did you restart the machine?
Lapo
--
gotoAndPlay()
...addicted to flash games
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 28 Oct 2010, 07:59

Booting didnt help.

I suspect the latest Apple Java update to be buggy.

No matter what I write as time setting, it ignores it and uses 5 or 15 or 75 seconds (etc)

/Thomas
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 28 Oct 2010, 08:51

Non SFS related. Its something inside my own code doing this

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 132 guests