1.java Foundation is not strong, about the object and class declaration cycle, etc. do not understand
When you do the app login token verification. I designed a tokenutil to add a member variable map, each time the login succeeds, put tokens in. Removed later to verify. Did a test, landed, re-visited, no problem, show landed successfully.
Then thought OK, then suddenly want to change a user login to see, so it delirious. Because I found that when I change a user login, the original user login is invalid. How can this be.
So, I tried n methods, both failed. Think of feeling wrong, originally I was a user in the landing, just toke changed, I record token is the user ID key.
In this way, I refresh the landing page, found token transform (token with timestamp encryption), that is the new user login. In fact, I find that there is always only one set of tokens in the map, and I suspect that this class will not be initialized any time, and I don't know how the life cycle is going to count. And, of course, I'm not going to figure out what the declaration cycle is. Trying another method doesn't work either. After debugging n times suddenly found that my key has been the same, think of the map when the key is the same time back to overwrite the original. So, excited. Again, it sure is possible.
This way, the description class is always loaded and not destroyed. And I am a careless problem is, I put the refresh login as a new user login, and mark the user login key is the user ID, the same user of course will only mark a group.
Lesson:
I should slow down and think about the problem carefully. From the beginning, a little bit of thinking, I should first think: Analog login 1th Enter the user name and password. And this point if you see clearly will find the problem solved, I have always been a user to test the results of multiple users, certainly not. In addition, and I was too confused, not to understand the life cycle and multi-threaded synchronization and other issues. Wait for a closer look.
A variety of problems that are not experienced in the project