0

I wrote a Java game with some singleton classes. The specifications provide that several matches of this game can start on the same Server, so I used TheadLocal variables to instance Singleton classes in different thread. The problem is that when Server communicates with a Client it's like the Controller's thread change, so the instances of the ThreadLocal are resetted. Is this normal? What can I do?

Sorry for my bad english, thank you in advance.

1 Answers1

0

This will never work. The RMI Specification makes no guarantees about any association between clients, or client threads, and server threads.

It seems to me that you are looking for the Remote Session pattern.

user207421
  • 305,947
  • 44
  • 307
  • 483