Re: Recommended way to clean up a component?
"Dirk Olmes" <[email protected]>
| Newsgroups | gmane.comp.java.tapestry.devel |
|---|---|
| Message-ID | <[email protected]> |
> I have some components that retrieve and store a copy of a db object in
> a local variable which is accessed many times by the component. The
> object is lazily loaded like this:
>
> Object getCachedDBObject() {
> if (m_cachedDBObject == null) {
> m_cachedDBObject = retrieveObjectFromDB();
> }
> return m_cachedDBObject;
> }
>
> At the end of the current cycle, m_cachedDBObject needs to be nulled out
> so the next time the component is used it'll get a new copy.
So far I've used the method initialize() on the Page which is called from
the constructor as well as from detach(). It should do what you want.
-dirk
--
Anyway kids, have fun, play nicely, be good. And remember - if it ain't
broke, hit it again.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf