Spring MVC: session beans from two different sessions?

Going back to your basic design, you'll have to reconsider if your "PlayerHandler" really is session scoped, conceptually. Since you require access to it outside the scope of a given session (a thread handling a request for a specific session), it looks like it is not.

Going back to your basic design, you'll have to reconsider if your "PlayerHandler" really is session scoped, conceptually. Since you require access to it outside the scope of a given session (a thread handling a request for a specific session), it looks like it is not. One way to refactor this would be to move the "PlayerHandler" out to the application scope.

Create a global singleton bean, call it "PlayerHandlerHolder" maybe, with a map that holds PlayerHandler instances keyed to session id, for instance. To prevent infinitely filling up this map, you could implement a session listener that removes PlayerHandler instances from the map on session destroy.

One way to solve your problem would be to create a custom scope, call it "game". Now define your bean like this.

When the public Object get(String name, ObjectFactory objectFactory) method is invoked on the class implementing Scope for my custom scope (GameScope), I have no way to differentiate between the two instances - name is the same for both beans, "scopedTarget. PlayerHandler". – Jens Aug 22 at 13:59 @Jens I'm not saying that's the only part of the design you need to change.

Perhaps the scoped proxy approach won't work at all. But since you apparently need a scope between request, session and application, I was just offering an idea. – Sean Patrick Floyd Aug 22 at 14:09.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions