Re: How to release cached objects ?
Armin Waibel <[email protected]>
| Newsgroups | gmane.comp.jakarta.ojb.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Bruno, Bruno CROS wrote: > Hi Armin, thank you for answering so quickly. That's always very nice. > > Sorry, but I have 3 more questions about clearing Object Caches : > > - When PersistenceBrokerFactory.releaseAllInstances is done, does Object > Caches are reset? Nope. > > - Can, either of these ways to clear cache ( > PersistenceBrokerFactory.releaseAllInstances (if it is so) and > PB.clearCache ), damage running transactions using released cached > objects ? I think the PersistenceBrokerFactory.releaseAllInstances could prevent running PB instances to release itself back to pool (but OJB will catch this exception). The PB.clearCache() shouldn't affect other running tx (but I never wrote a test to verify this). > > - If I choose the PB.clearCache(), how can i iterate *all* the PBs i > have in > my pool ? I can get one PB from the pool, but i don't known how to get the > whole collection. PB.clearCache() will clear all used caches (because all implementations shipped with OJB use a static map to manage the cached objects). But the session caches of other running PB instances are not cleared (when using the two-level cache). Anyway I recommend to write a simple test to verify me answer to play it safe. regards, Armin > > Thanks again, and again... > > Regards > > > > Now, my need would be to getAllBroker from > > > On 11/13/06, Armin Waibel <[email protected]> wrote: >> >> Hi Bruno, >> >> Bruno CROS wrote: >> > Hi, >> > >> > Just about a little question. >> > >> > Does PersistenceBrokerFactory.releaseAllInstances() release all cached >> > objects? >> > >> > I'm using PersistenceBrokerFactoryDefaultImpl and ObjetCacheDefaultImpl >> > (and >> > OJB 1.0.4.) >> > >> > The goal is to force server to reload all OJB mapped objects. Is >> there a >> > proper foreseen method to call to do this? >> > >> >> Evict all caches: >> >> PB.clearCache() >> >> or >> >> PB.serviceObjectCache().clear() >> >> With >> PersistenceBrokerFactory.releaseAllInstances() >> >> you will release all pooled PB instances and reset the the PB pool. >> >> regards, >> Armin >> >> > Thanks a lot. >> > >> > Bruno >> > >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> >