-
Threading issue
Hello guys,
I just post here to ask some idea or opinion to start with ^_^
I have a jsp and a servlet. typically my jsp is the gui and contains the validations so there is no problem with that. In servlet i have the process and call some java class as batch process and they work in harmony for the case that there is only one user that is currently working on it.
By nature, servlet are multi threaded rigth? Can you give me a hint of idea how to make a stop light to prevent overwriting of variables if 2 or more users are using the system. =) And based from what ive read single threading is not an option and i dont want to create a new code.
In my case it is Ok to create a stop light like when someone tries to access that class when some is still using it the system would make that user with until it is free. It will make my system feel some bottle neck effect but the users are controlled so it wont matter much (around 1-5 users only and the processing is by request).
Thanks a lot ^_^
-
Don't use any instance variables.
-
yup im trying to avoid using instances variables. So i just want to implement somekind of Stop ligth. preventing a another user or something like letting one user at a time access a servlet =)