cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Jarrel <>
Subject 3.1 Module & Cache Configuration
Date Tue, 13 Sep 2011 13:30:06 GMT
Hi All Again,

Still doing testing on the new configuration and rewriting some code
to 3.1, and have come across the following issue:

My configuration code again:

Module extensions = new Module() {
    public void configure(Binder binder) {

ServerRuntime sr = new ServerRuntime("cayenne-cdao.xml", extensions);
DataDomain domain = sr.getDataDomain();
DataNode node = domain.getNode("cdaoNode");

Since I'm testing how my app handles caching invalidation using the
new DataChannelFilter I have 2 utility methods:

protected QueryCache getSharedCache() {
    NestedQueryCache cache = (NestedQueryCache) ((DataContext)
    if (osCache)
        assertEquals(OSQueryCache.class, cache.getDelegate().getClass());

    return cache.getDelegate();

protected QueryCache getLocalCache() {
    NestedQueryCache cache = (NestedQueryCache) ((DataContext)
    if (osCache)
        assertEquals(OSQueryCache.class, cache.getDelegate().getClass());

    return cache.getDelegate();

In the test case 2 simple calls as follows:

OSQueryCache domainCache = (OSQueryCache) getSharedCache();
OSQueryCache contextCache = (OSQueryCache) getLocalCache();

now what I am finding is that both domainCache and contextCache is the
same object, when I would have though they would have been two
different instance of OSQueryCache given that one is the local cache
and the other is the shared cache.

Is there something I am missing here?

Thank you


View raw message