cancel
Showing results for 
Search instead for 
Did you mean: 

How to create portal singleton object ?

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

Qualiture
Active Contributor
0 Kudos

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

siarhei_pisarenka3
Active Contributor
0 Kudos
Former Member
0 Kudos

no, it is about standard java singleton,
but I ask about how it is NOT  works in J2EE environment, and why so ?