ok, here is my problem people and i would appreciate any help.
i am making a chat program using regular sockets and streams to pass the data.
im having a database that holds the name and passwords of the users, and a hashMap in the server that holds the users who are online.
Whenever a user logs in or logs off, his name is added to the HashMap or is removed from it.
The methods from adding to the HashMap or removed arent synchronzied right now so i thought this can cause problems if 2 users will log in and out in the same time (or even 2 will log on together).
now, i want to synchronize them but i have a question:
say 1 user logs in and another logs off at the same time.
both send a message to the server to update their status. however if one managed to get the lock of the server will the other message wait till
thread is finished or will it just skip the method all together. to clarify it will both message get executed or only one??
