Room extension sleep()
Posted: 18 Apr 2012, 14:27
Inisde my room extension, i am using the sleep() function to cause a delay after the room filling up and before the game officialy starting
//last person joined
try{
//take 5
Thread.sleep(parent.GAME_START_PAUS_TIME_MILI);//if player exits now, ok game not started, they get back the cash
}catch(InterruptedException e){}
//start the game
I am just putting the delay hear in the room extension over in the server side, so that over on the client side I can play some animation ect, and the client has a change to they bail out if they want.
Is putting a room extension to Sleep a good idea ?, will this cause scailing proablems if we get loads of sleeping threads ?,
The aulternative is using the one zone level TaskSheduler, to start all unstarted games every 5 secs,
giving a delay of 0 to 5 secs depening when the room was created in time, in relation the the TaskSheduler interval period,
so not giving a constant delay.
//last person joined
try{
//take 5
Thread.sleep(parent.GAME_START_PAUS_TIME_MILI);//if player exits now, ok game not started, they get back the cash
}catch(InterruptedException e){}
//start the game
I am just putting the delay hear in the room extension over in the server side, so that over on the client side I can play some animation ect, and the client has a change to they bail out if they want.
Is putting a room extension to Sleep a good idea ?, will this cause scailing proablems if we get loads of sleeping threads ?,
The aulternative is using the one zone level TaskSheduler, to start all unstarted games every 5 secs,
giving a delay of 0 to 5 secs depening when the room was created in time, in relation the the TaskSheduler interval period,
so not giving a constant delay.