Thread

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

Moderators: Lapo, Bax

Ceciaman
Posts: 45
Joined: 13 Feb 2009, 11:35

Thread

Postby Ceciaman » 12 May 2021, 05:44

Hi,
everytime i open a room threads aumented of 1 unit and never decrease.
I use javascript serverside code.
use 1 scheduler that close when destroy the room.

i declare olso var dbMan = getParentZone().getDBManager();
i must destroy olso "dbMan"?

if yes in Destroy function how can i do this.

Destroy(dbMan); // is error
dbMan.cancel ; //is not a function
How can do it?

Every time i use a connection use this code is correct?

var connection = dbMan.getConnection();
var stmt = connection.prepareStatement("UPDATE utenti SET vinte2=vinte2+"+V+",perse2=perse2+"+P+",pareggiate2=pareggiate2+"+PP+",abbandoni=abbandoni+"+A+" WHERE user='"+P1+"'");
var result = stmt.executeUpdate();
if (stmt != null){
stmt.close();
}
if (connection != null){
connection.close();
}

T's
User avatar
Lapo
Site Admin
Posts: 22064
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Thread

Postby Lapo » 12 May 2021, 07:16

Hi,
if every Room Extension starts a new Scheduler, then the thread count is expected to increase with every new Room.
The only problem is making sure to remove it in the destroy() method of your Room Extension, like this:

Code: Select all

function destroy()
{
    scheduler.destroy(null);
}


The true parameter forces the Scheduler to stop immediately. If you don't pass it, the scheduler will be destroyed when all the Tasks in its queue have been processed.

i declare olso var dbMan = getParentZone().getDBManager();
i must destroy olso "dbMan"?

No, you don't need to destroy this.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Ceciaman
Posts: 45
Joined: 13 Feb 2009, 11:35

Re: Thread

Postby Ceciaman » 12 May 2021, 09:04

thank's it works

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 34 guests