on 04-25-2012 1:10 PM
I want to create cache for some kind of objects,
created for this static property of the some class and try to access it from everywhere.
but found that once initialized object remains same for new session even if I change it in previous session.
so behavior is not correct as singleton, but something complex and not manageable.
questions:
why object is so strange assignable - only once ? how to make it changeable for many sessions?
how to make real singleton?
thanks
Hi Vladimir,
Just a thought; are you running a single J2EE servernode system, or are there more server nodes configured?
The behavior I sometimes see with singleton objects is they are singleton within it's current server node, but when invoked from a different server node, it gets reinitialized or falls back to an old value.
If you're running a single node system, then I think something else is happening though, since the singleton pattern should work just fine on one node
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vladimir
Try one of these patterns: http://stackoverflow.com/questions/70689/efficient-way-to-implement-singleton-pattern-in-java
Regards, Siarhei
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.