-
1. Re: how can I keep a kind of global object (Singleton) in JB
david.salter Jun 18, 2004 4:59 AM (in response to davidchen)Can't you just create a singleton and access it through a stateless session bean?
-
2. Re: how can I keep a kind of global object (Singleton) in JB
darranl Jun 18, 2004 5:03 AM (in response to davidchen)Can't you just create a singleton and access it through a stateless session bean?
No you can't
If you write singletons you need to be aware that the application server may create multiple instances of the singleton depending on classloaders and how many JVM instances the app server is running in. -
3. Re: how can I keep a kind of global object (Singleton) in JB
snavjot Jun 18, 2004 9:27 AM (in response to davidchen)hi,
you can read the data from DB, create an object ans save at some JNDI location.
Now, just access the same JNDI location.
Is that good enough solution?
Navjot Singh -
4. Re: how can I keep a kind of global object (Singleton) in JB
kelle Sep 10, 2004 3:25 PM (in response to davidchen)snavjot, I need to create a singleton object cache and this sounds like the solution I am looking for. I am not familiar with some of your terminology though. What is an "object ans." Could you please elaborate on your solution. Thanks.
-Kevin -
5. Re: how can I keep a kind of global object (Singleton) in JB
darranl Sep 10, 2004 4:25 PM (in response to davidchen)"object ans" is a typo, the sentence should have read.
you can read the data from DB, create an object and save at some JNDI location. -
6. Re: how can I keep a kind of global object (Singleton) in JB
enterprisejavabones Sep 21, 2004 6:44 AM (in response to davidchen)Another possible solution is to implement this database viewe as a managed resource, i.e. as a JMX MBean. Given that your needs require an updated copy, your get DBView() method (or whatever you call it) can load the DBView when first called and subsequently check for staleness on subsequent invocations.
Perhaps you may wanna have a look at implementing your managed resource (MBean) as a standard MBean, those are not too difficult to implement and may serve you purpose.
Cheers -
7. Re: how can I keep a kind of global object (Singleton) in JB
jigneshsr Jan 10, 2005 2:38 AM (in response to davidchen)I think caching ur data in xml object probably a huge dom stucture is good one tohave