The SFS2x version I use is 2.13.
I put the SFS2X on the server. The SFS2X server and DB server is on diff location.
Like the subject, there's a delay on the method I called.
The scenario is, when the player ready, the server check all the player data then update the data to database.
The delay is depends on how much the player on the room (max player is 6 for each room and the requirement is min 2 player ready to start the game). Let say there are 2 players ready, then it got delay for 1 second ( 1st player doesn't count), if 3 players ready then it got delayed for 2 second.
I didn't put any scheduler task and it is just a simple for looping.
Here's the loop code that I use :
Code: Select all
for (int userPos = 0; userPos < userList.size(); userPos++) {
if (!userList.get(userPos).equals("")) {
int userB = bList.get(userPos);
String userName = userList.get(userPos);
if (userB == -1 && userPos != 3) {
userB = minB;
sendToClient(userPos, userB);
}
updateData(userB, userName);
bList.set(userPos, userB);
}
}
It got delayed when call updateData() on the next player. Inside updateData is just a simple Query declaration, then I called the executeUpdate() using IDBManager.
Is the SFS2X server waiting for return on executeUpdate() ? Or maybe waiting for something until the executeUpdate() success then running the next task?
Thank you