How can I handle static varibles inside my server session?
I have 30 different functions with no real realtion on the server, but they currently share data over some static varibles (I know this is bad, but I was just testing it). Now if I have different clients connecting to the server, they would interfear with each other an no client would get the right data.
So I wondered what a good way to handle this diferent Session datas without passing twenty refernce to the other objects to a class when creating a class.
Another problem is, that the classes instanciate threads, so I can’t be shure, that the actions are completed when I send the responses back to the server. (So switchin the current static varibles depending on the client is not an option)
If you don’t want to put all these things in the session (
session.setAttribute(..)and.getAttribute()) then perhaps you can use a map of maps:and set/get from that map. Where:
session.getId()Thus you will be able to have values unique to sessions without relying on the servlet API.