java: race conditions - is there a way to make sure several lines of code will be executed together?
问题 I have a registration page that receives tokens ad parse them and login the user if the parameters apply. Between the time that i checked the token, to the time that i removed the token from the db, another user can use the same token to login. is there a way to make sure that specific range of lines of code will be executed with not interference, so i won't have race condition problem ? thanks update I have two servers. apache tomcat 6 red5 v0.9 (free java based flash media streaming and