openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <curti...@gmail.com>
Subject Re: EntityManagerFactory clearing caches on close()?
Date Thu, 03 Feb 2011 17:43:27 GMT
Alex -

> Isn't it up to the Cache to make decisions about distribution or not ?
Yes and our built-in implementation (ConcurrentQueryCache) doesn't
distribute.

> I just wonder why the QueryCache is explicitly being cleared on close().
This is due to the AbstractQuery(Data)Cache implementation(s). Close
delegates to clear() to free up the resources used by the cache. ... which
makes sense when running in a single JVM and not so much when running
distributed.

@from javadoc
AbstractQueryCache.close()  -> Free the resources used by this cache.
AbstractQueryCache.clear() -> Remove all data from this cache.

> As I guess we could indeed override Abstract(Query|Data)Cache.close() to
call close(false) rather than true by default.
I think you should implement Cache.close() and do what is right for your
implementation. The Abstract implementations are there for guidance, not the
end all answer.

Thanks,
Rick

On Thu, Feb 3, 2011 at 11:26 AM, Alex Snaps <alex.snaps@gmail.com> wrote:

> I'm indeed "using" the ehcache plugin. I'm actually working on
> maintaining that code base.
> But I don't really understand what you mean with "we don't distribute
> the QueryCache". Isn't it up to the Cache to make decisions about
> distribution or not ? I just wonder why the QueryCache is explicitly
> being cleared on close(). I probably should dig more into this, but
> AbstractDataCache has the same close(boolean?) implementations. So
> that on close a cache seems to be cleared by default. Just trying to
> understand. As I guess we could indeed override
> Abstract(Query|Data)Cache.close() to call close(false) rather than
> true by default.
> Any insight is appreciated.
> Thanks,
> Alex
>
> On Thu, Feb 3, 2011 at 6:14 PM, Rick Curtis <curtisr7@gmail.com> wrote:
> > Alex -
> >
> > Hmmm, by any chance are you using the ehcache plugin? If so, it is
> probably
> > an issue with the plugin implementation. AFAIK with the built in query
> cache
> > we don't distribute the QueryCache.
> >
> > Thanks,
> > Rick
> >
> > On Thu, Feb 3, 2011 at 10:58 AM, Alex Snaps <alex.snaps@gmail.com>
> wrote:
> >
> >> Hi guys,
> >> I've not investigated that much at the code level yet, but it seems
> >> EntityManagerFactory.close() calls AbstractQueryCache.close() which in
> >> turn calls clearInternal(). As a result a distributed query cache ends
> >> up cleared when a node is shut down. This only seems to happen on the
> >> query cache though. Is it meant that way? If so, does that mean a
> >> query cache shouldn't be clustered?
> >> Thanks,
> >> Alex
> >>
> >> --
> >> Alex Snaps <alex.snaps@gmail.com>
> >> Senior Software Engineer - Terracotta
> >> http://twitter.com/alexsnaps
> >> http://www.linkedin.com/in/alexsnaps
> >>
> >
>
>
>
> --
> Alex Snaps <alex.snaps@gmail.com>
> Senior Software Engineer - Terracotta
> http://twitter.com/alexsnaps
> http://www.linkedin.com/in/alexsnaps
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message