views:

462

answers:

1

I want to use JCS (Java Cache System) to cache ldap queries which should be shared by multiple EJB's (class loaders) to avoid the duplicate searches. I have created a singleton wrapper to create only one instance of JCS cache but due to each EJB's having their own class loader, it creates multiple instance of JCS cache so ldap search results are not reused.

Is there any way to create a true singleton which can be shared by multiple EJBs/Class loaders? One of my friend suggested to create a EJB wrapper on my singleton. Is it right approach? Can't I implement without EJB? I saw and article about how to implement "Absolute Singleton" but when I tried the solution it didn't work. See "Absolute Singleton. Not really..".

A: 

Found the answer here. This is specific to Glassfish enviornment.

rjoshi