You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by sgjava <sg...@gmail.com> on 2015/09/14 19:09:33 UTC

JCache annotations using default cache instead of MutableConfiguration or configuration file

It looks like JCache (commons-jcs) is creating a default cache even though I
use:

@CacheDefaults(cacheName = "testCache", cacheKeyGenerator
        = StringKeyGenerator.class)

Even if I use:

        cacheManager = cachingProvider.getCacheManager(new File(
                "src/main/resources/jcache.ccf").toURI(),
                Thread.currentThread().getContextClassLoader(),
cachingProvider.
                getDefaultProperties());
        MutableConfiguration<StringGeneratedCacheKey, String> config
                = new MutableConfiguration<>();
        config.setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(
                new Duration(TimeUnit.MINUTES, 10)));
        cache = cacheManager.createCache("testCache", config);

In the logs I see both caches being created:

Using getCacheManager:

INFO: initialized MemoryCache for testCache
Sep 14, 2015 1:07:58 PM org.apache.commons.jcs.engine.control.CompositeCache
<init>
INFO: Constructed cache with name [testCache] and cache attributes [
useLateral = true, useRemote = true, useDisk = true, maxObjs = 200001,
maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
Sep 14, 2015 1:07:58 PM
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
parseAuxiliary
SEVERE: Could not instantiate auxFactory named "DC".
Sep 14, 2015 1:07:58 PM
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
parseRegions
INFO: Parsed regions [testCache]

Then the default version:

INFO: initialized MemoryCache for testCache
Sep 14, 2015 1:07:58 PM org.apache.commons.jcs.engine.control.CompositeCache
<init>
INFO: Constructed cache with name [testCache] and cache attributes [
useLateral = true, useRemote = true, useDisk = true, maxObjs = 100,
maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]

The annotations are using athe default configuration.




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/JCache-annotations-using-default-cache-instead-of-MutableConfiguration-or-configuration-file-tp4676198.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: JCache annotations using default cache instead of MutableConfiguration or configuration file

Posted by Steve Goldsmith <sg...@gmail.com>.
Very cool, will check it out now...

On Mon, Sep 14, 2015 at 2:59 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> this is a manual deploy AFAIK - maybe I missed an automatic job here, just
> did run it now.
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>
> 2015-09-14 11:36 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
>
> > OK, what time EDT does the SNAPSHOT build complete?
> >
> > On Mon, Sep 14, 2015 at 2:02 PM, Romain Manni-Bucau <
> rmannibucau@gmail.com
> > >
> > wrote:
> >
> > > should work AFAIK, maybe update your project adding a test failling in
> > the
> > > case you meet and I'll try to check tonight
> > >
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > <http://rmannibucau.wordpress.com> | Github <
> > > https://github.com/rmannibucau> |
> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > <http://www.tomitribe.com>
> > >
> > > 2015-09-14 10:51 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
> > >
> > > > OK, I'm using commons-jcs-jcache 2.0-SNAPSHOT as of today and this is
> > the
> > > > behavior I'm getting. What I'd like if for getCacheManager(new
> > > >
> > > >
> > >
> >
> File("src/main/resources/jcache.ccf").toURI(),Thread.currentThread().getContextClassLoader(),
> > > > cachingProvider.             getDefaultProperties()) to work with
> > > > @CacheDefaults(cacheName = "testCache").
> > > >
> > > > Which release should I use?
> > > >
> > > > jcs.region.testCache=DC
> > > >
> > > >
> > >
> >
> jcs.region.testCache.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
> > > > jcs.region.testCache.cacheattributes.MaxObjects=200001
> > > >
> > > >
> > >
> >
> jcs.region.testCache.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache
> > > > jcs.region.testCache.cacheattributes.UseMemoryShrinker=true
> > > > jcs.region.testCache.cacheattributes.MaxMemoryIdleTimeSeconds=3600
> > > > jcs.region.testCache.cacheattributes.ShrinkerIntervalSeconds=60
> > > >
> > > >
> > >
> >
> jcs.region.testCache.elementattributes=org.apache.commons.jcs.engine.ElementAttributes
> > > > jcs.region.testCache.elementattributes.IsEternal=false
> > > > jcs.region.testCache.elementattributes.MaxLife=600
> > > > jcs.region.testCache.elementattributes.IdleTime=1800
> > > > jcs.region.testCache.elementattributes.IsSpool=true
> > > > jcs.region.testCache.elementattributes.IsRemote=true
> > > > jcs.region.testCache.elementattributes.IsLateral=true
> > > >
> > > > On Mon, Sep 14, 2015 at 1:20 PM, Romain Manni-Bucau <
> > > rmannibucau@gmail.com
> > > > >
> > > > wrote:
> > > >
> > > > > Hi
> > > > >
> > > > > not with the snapshot normally but in last available release yes -
> > has
> > > > been
> > > > > fixed in between
> > > > >
> > > > >
> > > > > Romain Manni-Bucau
> > > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > > <http://rmannibucau.wordpress.com> | Github <
> > > > > https://github.com/rmannibucau> |
> > > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > > > <http://www.tomitribe.com>
> > > > >
> > > > > 2015-09-14 10:09 GMT-07:00 sgjava <sg...@gmail.com>:
> > > > >
> > > > > > It looks like JCache (commons-jcs) is creating a default cache
> even
> > > > > though
> > > > > > I
> > > > > > use:
> > > > > >
> > > > > > @CacheDefaults(cacheName = "testCache", cacheKeyGenerator
> > > > > >         = StringKeyGenerator.class)
> > > > > >
> > > > > > Even if I use:
> > > > > >
> > > > > >         cacheManager = cachingProvider.getCacheManager(new File(
> > > > > >                 "src/main/resources/jcache.ccf").toURI(),
> > > > > >                 Thread.currentThread().getContextClassLoader(),
> > > > > > cachingProvider.
> > > > > >                 getDefaultProperties());
> > > > > >         MutableConfiguration<StringGeneratedCacheKey, String>
> > config
> > > > > >                 = new MutableConfiguration<>();
> > > > > >
> >  config.setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(
> > > > > >                 new Duration(TimeUnit.MINUTES, 10)));
> > > > > >         cache = cacheManager.createCache("testCache", config);
> > > > > >
> > > > > > In the logs I see both caches being created:
> > > > > >
> > > > > > Using getCacheManager:
> > > > > >
> > > > > > INFO: initialized MemoryCache for testCache
> > > > > > Sep 14, 2015 1:07:58 PM
> > > > > > org.apache.commons.jcs.engine.control.CompositeCache
> > > > > > <init>
> > > > > > INFO: Constructed cache with name [testCache] and cache
> attributes
> > [
> > > > > > useLateral = true, useRemote = true, useDisk = true, maxObjs =
> > > 200001,
> > > > > > maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2
> ]
> > > > > > Sep 14, 2015 1:07:58 PM
> > > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > > parseAuxiliary
> > > > > > SEVERE: Could not instantiate auxFactory named "DC".
> > > > > > Sep 14, 2015 1:07:58 PM
> > > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > > parseRegions
> > > > > > INFO: Parsed regions [testCache]
> > > > > >
> > > > > > Then the default version:
> > > > > >
> > > > > > INFO: initialized MemoryCache for testCache
> > > > > > Sep 14, 2015 1:07:58 PM
> > > > > > org.apache.commons.jcs.engine.control.CompositeCache
> > > > > > <init>
> > > > > > INFO: Constructed cache with name [testCache] and cache
> attributes
> > [
> > > > > > useLateral = true, useRemote = true, useDisk = true, maxObjs =
> 100,
> > > > > > maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2
> ]
> > > > > >
> > > > > > The annotations are using athe default configuration.
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > View this message in context:
> > > > > >
> > > > >
> > > >
> > >
> >
> http://tomee-openejb.979440.n4.nabble.com/JCache-annotations-using-default-cache-instead-of-MutableConfiguration-or-configuration-file-tp4676198.html
> > > > > > Sent from the TomEE Users mailing list archive at Nabble.com.
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Steven P. Goldsmith
> > > >
> > >
> >
> >
> >
> > --
> > Steven P. Goldsmith
> >
>



-- 
Steven P. Goldsmith

Re: JCache annotations using default cache instead of MutableConfiguration or configuration file

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Le 15 sept. 2015 18:58, "Steve Goldsmith" <sg...@gmail.com> a écrit :
>
> So if I use something like:
>
> @CacheResult(cacheName = "testCache", cacheResolverFactory =
MyFactory.class)
>
> I can select the cache I want? Does this work with the rest of the JCache
> annotations? There are situations where you really need the cache shared
> across applications and most caching frameworks allow network access, not
> just within the same JVM or app.
>

Yes. JCS allows it as well with rmi, http, ...

> On Tue, Sep 15, 2015 at 9:42 PM, Romain Manni-Bucau <rmannibucau@gmail.com
>
> wrote:
>
> > 2015-09-15 16:39 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
> >
> > > OK, maybe it's easier to explain what I'm looking for and you can
> > recommend
> > > the correct JCache way of doing things. I want to use a named cache
> > > initialized by a configuration file. The named cache should be
> > considered a
> > > Singleton, since I should be able to share it between applications and
> > > especially method invocations. I did another commit that moved the
> > > configuration files out of the main and test classpath. This resulted
in
> > > the cache not initializing for each test method. For each test using
> > > Ehcache provider I see (using annotations):
> > >
> > >
> > well it depends the provider but basically you still get
manager/provider
> > per application then the storage depends on the provider. JCS will
likely
> > isolate apps to avoid to leak wrong data between apps by default.
> >
> >
> >
> >
> > > WARNING: No Cache named 'testCache' was found in the CacheManager, a
> > > default cache will be created.
> > >
> > > I do not want the default cache, I want testCache. Also the
@CacheResult
> > > method isn't working correctly since it's adding the came key again:
> > >
> >
> >
> > > cacheManager = cachingProvider.getCacheManager(new
> > > File("src/config/ehcache.xml").toURI(), null, null);
> > >
> > >
> > Well this has no link with @CacheResult, you need a
cacheResolverFactory to
> > do so
> >
> >
> > > Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean
> > > invalidateCache
> > > INFO: Cache invalidated
> > > Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean
slowMethod
> > > INFO: Adding key: key1, value: value1
> > > Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean
slowMethod
> > > INFO: Adding key: key2, value: value2
> > > Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean
slowMethod
> > > INFO: Adding key: key3, value: value3
> > > Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean
slowMethod
> > > INFO: Adding key: key1, value: value1
> > >
> > > but if I do:
> > >
> > > cacheManager = cachingProvider.getCacheManager() with ehcache.xml in
> > > src/main/resources
> > >
> > > Sep 15, 2015 7:26:00 PM com.codeferm.jcache.tomee.KeyValueBean
> > > invalidateCache
> > > INFO: Cache invalidated
> > > Sep 15, 2015 7:26:00 PM com.codeferm.jcache.tomee.KeyValueBean
slowMethod
> > > INFO: Adding key: key1, value: value1
> > > Sep 15, 2015 7:26:00 PM com.codeferm.jcache.tomee.KeyValueBean
slowMethod
> > > INFO: Adding key: key2, value: value2
> > > Sep 15, 2015 7:26:00 PM com.codeferm.jcache.tomee.KeyValueBean
slowMethod
> > > INFO: Adding key: key3, value: value3
> > >
> > > it works. The only way JCache providers seem to work correctly is
loading
> > > configuration from default classpath.
> > >
> > > On Tue, Sep 15, 2015 at 5:00 PM, Romain Manni-Bucau <
> > rmannibucau@gmail.com
> > > >
> > > wrote:
> > >
> > > > looks like behaving correctly according your config which is
> > initialized
> > > by
> > > > the backing JCS cache manager - not the JCache facade one.
> > > >
> > > >
> > > > Romain Manni-Bucau
> > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > <http://rmannibucau.wordpress.com> | Github <
> > > > https://github.com/rmannibucau> |
> > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > > <http://www.tomitribe.com>
> > > >
> > > > 2015-09-15 12:44 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
> > > >
> > > > > It's there https://github.com/sgjava/jcache-tomee. CacheBeanTest
has
> > > > been
> > > > > modified not to use testCache =
> > > > > cacheBean.getCacheManager().getCache("testCache"), only
annotations.
> > > You
> > > > > will see from the logging that the default cache is created
several
> > > > times.
> > > > > This makes no sense. I'll switch back to EHcache and see what it
does
> > > > while
> > > > > you are looking at the source. UserServiceJCacheTest will fail
> > because
> > > it
> > > > > compares cache with
> > cacheBean.getCacheManager().getCache("testCache").
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Tue, Sep 15, 2015 at 2:35 PM, Romain Manni-Bucau <
> > > > rmannibucau@gmail.com
> > > > > >
> > > > > wrote:
> > > > >
> > > > > > can you push it all to github? maybe some semantic issue in our
> > > > > > communication so would check it on a running example
> > > > > >
> > > > > >
> > > > > > Romain Manni-Bucau
> > > > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > > > <http://rmannibucau.wordpress.com> | Github <
> > > > > > https://github.com/rmannibucau> |
> > > > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > > > > <http://www.tomitribe.com>
> > > > > >
> > > > > > 2015-09-15 10:48 GMT-07:00 sgjava <sg...@gmail.com>:
> > > > > >
> > > > > > > OK, I tried the snapshot again and it still creates a default
> > cache
> > > > > > trying:
> > > > > > >
> > > > > > >     @PostConstruct
> > > > > > >     public void init() {
> > > > > > >         log.info("PostConstruct");
> > > > > > >         cachingProvider = Caching.getCachingProvider();
> > > > > > >         //cacheManager = cachingProvider.getCacheManager();
> > > > > > >         log.info("getCacheManager");
> > > > > > >         cacheManager = cachingProvider.getCacheManager(new
File(
> > > > > > >                 "src/main/resources/jcache.ccf").toURI(),
> > > > > > >
 Thread.currentThread().getContextClassLoader(),
> > > > > > > cachingProvider.
> > > > > > >                 getDefaultProperties());
> > > > > > >     }
> > > > > > >
> > > > > > > It still creates a default cache after calling
getCacheManager:
> > > > > > >
> > > > > > > Sep 15, 2015 1:49:06 PM com.codeferm.jcache.tomee.CacheBean
init
> > > > > > > *INFO: PostConstruct*
> > > > > > > Sep 15, 2015 1:49:06 PM com.codeferm.jcache.tomee.CacheBean
init
> > > > > > > *INFO: getCacheManager*
> > > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > > org.apache.commons.jcs.utils.threadpool.ThreadPoolManager
> > > loadConfig
> > > > > > > INFO: thread_pool.default PoolConfiguration = useBoundary =
> > [true]
> > > > > > > boundarySize = [2000] maximumPoolSize = [150] minimumPoolSize
=
> > [4]
> > > > > > > keepAliveTime = [300000] whenBlockedPolicy = [RUN]
startUpSize =
> > > [4]
> > > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > >
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > > > setDefaultAuxValues
> > > > > > > INFO: Setting default auxiliaries to null
> > > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > >
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > > > parseCompositeCacheAttributes
> > > > > > > INFO: No special CompositeCacheAttributes class defined for
key
> > > > > > > [jcs.default.cacheattributes], using default class.
> > > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > >
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > > > setDefaultCompositeCacheAttributes
> > > > > > > INFO: setting defaultCompositeCacheAttributes to [ useLateral
=
> > > true,
> > > > > > > useRemote = true, useDisk = true, maxObjs = 100,
maxSpoolPerRun =
> > > -1,
> > > > > > > diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> > > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > >
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > > > parseElementAttributes
> > > > > > > INFO: No special ElementAttribute class defined for key
> > > > > > > [jcs.default.elementattributes], using default class.
> > > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > >
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > > > setDefaultElementAttributes
> > > > > > > INFO: setting defaultElementAttributes to [ IS_LATERAL = true,
> > > > > IS_SPOOL =
> > > > > > > true, IS_REMOTE = true, IS_ETERNAL = true, MaxLifeSeconds =
-1,
> > > > > IdleTime
> > > > > > =
> > > > > > > -1, CreateTime = 1442339346194, LastAccessTime =
1442339346194,
> > > > > > > getTimeToLiveSeconds() = -1, createTime = 1442339346194 ]
> > > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > >
> > > > >
> > >
org.apache.commons.jcs.engine.memory.AbstractDoubleLinkedListMemoryCache
> > > > > > > initialize
> > > > > > > INFO: initialized MemoryCache for testCache
> > > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > > org.apache.commons.jcs.engine.control.CompositeCache
> > > > > > > <init>
> > > > > > > INFO: Constructed cache with name [testCache] and cache
> > attributes
> > > [
> > > > > > > useLateral = true, useRemote = true, useDisk = true, maxObjs =
> > > > 200001,
> > > > > > > maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize
= 2
> > ]
> > > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > >
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > > > parseAuxiliary
> > > > > > > SEVERE: Could not instantiate auxFactory named "DC".
> > > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > >
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > > > parseRegions
> > > > > > > INFO: Parsed regions [testCache]
> > > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > >
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > > > doConfigure
> > > > > > > INFO: Finished configuration in 13 ms.
> > > > > > >
> > > > > > > testCache = cacheBean.getCacheManager().getCache("testCache")
> > also
> > > > > > creates
> > > > > > > a
> > > > > > > default cache.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > View this message in context:
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
http://tomee-openejb.979440.n4.nabble.com/JCache-annotations-using-default-cache-instead-of-MutableConfiguration-or-configuration-file-tp4676198p4676225.html
> > > > > > > Sent from the TomEE Users mailing list archive at Nabble.com.
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Steven P. Goldsmith
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Steven P. Goldsmith
> > >
> >
>
>
>
> --
> Steven P. Goldsmith

Re: JCache annotations using default cache instead of MutableConfiguration or configuration file

Posted by Steve Goldsmith <sg...@gmail.com>.
So if I use something like:

@CacheResult(cacheName = "testCache", cacheResolverFactory = MyFactory.class)

I can select the cache I want? Does this work with the rest of the JCache
annotations? There are situations where you really need the cache shared
across applications and most caching frameworks allow network access, not
just within the same JVM or app.

On Tue, Sep 15, 2015 at 9:42 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> 2015-09-15 16:39 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
>
> > OK, maybe it's easier to explain what I'm looking for and you can
> recommend
> > the correct JCache way of doing things. I want to use a named cache
> > initialized by a configuration file. The named cache should be
> considered a
> > Singleton, since I should be able to share it between applications and
> > especially method invocations. I did another commit that moved the
> > configuration files out of the main and test classpath. This resulted in
> > the cache not initializing for each test method. For each test using
> > Ehcache provider I see (using annotations):
> >
> >
> well it depends the provider but basically you still get manager/provider
> per application then the storage depends on the provider. JCS will likely
> isolate apps to avoid to leak wrong data between apps by default.
>
>
>
>
> > WARNING: No Cache named 'testCache' was found in the CacheManager, a
> > default cache will be created.
> >
> > I do not want the default cache, I want testCache. Also the @CacheResult
> > method isn't working correctly since it's adding the came key again:
> >
>
>
> > cacheManager = cachingProvider.getCacheManager(new
> > File("src/config/ehcache.xml").toURI(), null, null);
> >
> >
> Well this has no link with @CacheResult, you need a cacheResolverFactory to
> do so
>
>
> > Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean
> > invalidateCache
> > INFO: Cache invalidated
> > Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
> > INFO: Adding key: key1, value: value1
> > Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
> > INFO: Adding key: key2, value: value2
> > Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
> > INFO: Adding key: key3, value: value3
> > Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
> > INFO: Adding key: key1, value: value1
> >
> > but if I do:
> >
> > cacheManager = cachingProvider.getCacheManager() with ehcache.xml in
> > src/main/resources
> >
> > Sep 15, 2015 7:26:00 PM com.codeferm.jcache.tomee.KeyValueBean
> > invalidateCache
> > INFO: Cache invalidated
> > Sep 15, 2015 7:26:00 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
> > INFO: Adding key: key1, value: value1
> > Sep 15, 2015 7:26:00 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
> > INFO: Adding key: key2, value: value2
> > Sep 15, 2015 7:26:00 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
> > INFO: Adding key: key3, value: value3
> >
> > it works. The only way JCache providers seem to work correctly is loading
> > configuration from default classpath.
> >
> > On Tue, Sep 15, 2015 at 5:00 PM, Romain Manni-Bucau <
> rmannibucau@gmail.com
> > >
> > wrote:
> >
> > > looks like behaving correctly according your config which is
> initialized
> > by
> > > the backing JCS cache manager - not the JCache facade one.
> > >
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > <http://rmannibucau.wordpress.com> | Github <
> > > https://github.com/rmannibucau> |
> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > <http://www.tomitribe.com>
> > >
> > > 2015-09-15 12:44 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
> > >
> > > > It's there https://github.com/sgjava/jcache-tomee. CacheBeanTest has
> > > been
> > > > modified not to use testCache =
> > > > cacheBean.getCacheManager().getCache("testCache"), only annotations.
> > You
> > > > will see from the logging that the default cache is created several
> > > times.
> > > > This makes no sense. I'll switch back to EHcache and see what it does
> > > while
> > > > you are looking at the source. UserServiceJCacheTest will fail
> because
> > it
> > > > compares cache with
> cacheBean.getCacheManager().getCache("testCache").
> > > >
> > > >
> > > >
> > > >
> > > > On Tue, Sep 15, 2015 at 2:35 PM, Romain Manni-Bucau <
> > > rmannibucau@gmail.com
> > > > >
> > > > wrote:
> > > >
> > > > > can you push it all to github? maybe some semantic issue in our
> > > > > communication so would check it on a running example
> > > > >
> > > > >
> > > > > Romain Manni-Bucau
> > > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > > <http://rmannibucau.wordpress.com> | Github <
> > > > > https://github.com/rmannibucau> |
> > > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > > > <http://www.tomitribe.com>
> > > > >
> > > > > 2015-09-15 10:48 GMT-07:00 sgjava <sg...@gmail.com>:
> > > > >
> > > > > > OK, I tried the snapshot again and it still creates a default
> cache
> > > > > trying:
> > > > > >
> > > > > >     @PostConstruct
> > > > > >     public void init() {
> > > > > >         log.info("PostConstruct");
> > > > > >         cachingProvider = Caching.getCachingProvider();
> > > > > >         //cacheManager = cachingProvider.getCacheManager();
> > > > > >         log.info("getCacheManager");
> > > > > >         cacheManager = cachingProvider.getCacheManager(new File(
> > > > > >                 "src/main/resources/jcache.ccf").toURI(),
> > > > > >                 Thread.currentThread().getContextClassLoader(),
> > > > > > cachingProvider.
> > > > > >                 getDefaultProperties());
> > > > > >     }
> > > > > >
> > > > > > It still creates a default cache after calling getCacheManager:
> > > > > >
> > > > > > Sep 15, 2015 1:49:06 PM com.codeferm.jcache.tomee.CacheBean init
> > > > > > *INFO: PostConstruct*
> > > > > > Sep 15, 2015 1:49:06 PM com.codeferm.jcache.tomee.CacheBean init
> > > > > > *INFO: getCacheManager*
> > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > org.apache.commons.jcs.utils.threadpool.ThreadPoolManager
> > loadConfig
> > > > > > INFO: thread_pool.default PoolConfiguration = useBoundary =
> [true]
> > > > > > boundarySize = [2000] maximumPoolSize = [150] minimumPoolSize =
> [4]
> > > > > > keepAliveTime = [300000] whenBlockedPolicy = [RUN] startUpSize =
> > [4]
> > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > > setDefaultAuxValues
> > > > > > INFO: Setting default auxiliaries to null
> > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > > parseCompositeCacheAttributes
> > > > > > INFO: No special CompositeCacheAttributes class defined for key
> > > > > > [jcs.default.cacheattributes], using default class.
> > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > > setDefaultCompositeCacheAttributes
> > > > > > INFO: setting defaultCompositeCacheAttributes to [ useLateral =
> > true,
> > > > > > useRemote = true, useDisk = true, maxObjs = 100, maxSpoolPerRun =
> > -1,
> > > > > > diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > > parseElementAttributes
> > > > > > INFO: No special ElementAttribute class defined for key
> > > > > > [jcs.default.elementattributes], using default class.
> > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > > setDefaultElementAttributes
> > > > > > INFO: setting defaultElementAttributes to [ IS_LATERAL = true,
> > > > IS_SPOOL =
> > > > > > true, IS_REMOTE = true, IS_ETERNAL = true, MaxLifeSeconds = -1,
> > > > IdleTime
> > > > > =
> > > > > > -1, CreateTime = 1442339346194, LastAccessTime = 1442339346194,
> > > > > > getTimeToLiveSeconds() = -1, createTime = 1442339346194 ]
> > > > > > Sep 15, 2015 1:49:06 PM
> > > > > >
> > > >
> > org.apache.commons.jcs.engine.memory.AbstractDoubleLinkedListMemoryCache
> > > > > > initialize
> > > > > > INFO: initialized MemoryCache for testCache
> > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > org.apache.commons.jcs.engine.control.CompositeCache
> > > > > > <init>
> > > > > > INFO: Constructed cache with name [testCache] and cache
> attributes
> > [
> > > > > > useLateral = true, useRemote = true, useDisk = true, maxObjs =
> > > 200001,
> > > > > > maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2
> ]
> > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > > parseAuxiliary
> > > > > > SEVERE: Could not instantiate auxFactory named "DC".
> > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > > parseRegions
> > > > > > INFO: Parsed regions [testCache]
> > > > > > Sep 15, 2015 1:49:06 PM
> > > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > > doConfigure
> > > > > > INFO: Finished configuration in 13 ms.
> > > > > >
> > > > > > testCache = cacheBean.getCacheManager().getCache("testCache")
> also
> > > > > creates
> > > > > > a
> > > > > > default cache.
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > View this message in context:
> > > > > >
> > > > >
> > > >
> > >
> >
> http://tomee-openejb.979440.n4.nabble.com/JCache-annotations-using-default-cache-instead-of-MutableConfiguration-or-configuration-file-tp4676198p4676225.html
> > > > > > Sent from the TomEE Users mailing list archive at Nabble.com.
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Steven P. Goldsmith
> > > >
> > >
> >
> >
> >
> > --
> > Steven P. Goldsmith
> >
>



-- 
Steven P. Goldsmith

Re: JCache annotations using default cache instead of MutableConfiguration or configuration file

Posted by Romain Manni-Bucau <rm...@gmail.com>.
2015-09-15 16:39 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:

> OK, maybe it's easier to explain what I'm looking for and you can recommend
> the correct JCache way of doing things. I want to use a named cache
> initialized by a configuration file. The named cache should be considered a
> Singleton, since I should be able to share it between applications and
> especially method invocations. I did another commit that moved the
> configuration files out of the main and test classpath. This resulted in
> the cache not initializing for each test method. For each test using
> Ehcache provider I see (using annotations):
>
>
well it depends the provider but basically you still get manager/provider
per application then the storage depends on the provider. JCS will likely
isolate apps to avoid to leak wrong data between apps by default.




> WARNING: No Cache named 'testCache' was found in the CacheManager, a
> default cache will be created.
>
> I do not want the default cache, I want testCache. Also the @CacheResult
> method isn't working correctly since it's adding the came key again:
>


> cacheManager = cachingProvider.getCacheManager(new
> File("src/config/ehcache.xml").toURI(), null, null);
>
>
Well this has no link with @CacheResult, you need a cacheResolverFactory to
do so


> Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean
> invalidateCache
> INFO: Cache invalidated
> Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
> INFO: Adding key: key1, value: value1
> Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
> INFO: Adding key: key2, value: value2
> Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
> INFO: Adding key: key3, value: value3
> Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
> INFO: Adding key: key1, value: value1
>
> but if I do:
>
> cacheManager = cachingProvider.getCacheManager() with ehcache.xml in
> src/main/resources
>
> Sep 15, 2015 7:26:00 PM com.codeferm.jcache.tomee.KeyValueBean
> invalidateCache
> INFO: Cache invalidated
> Sep 15, 2015 7:26:00 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
> INFO: Adding key: key1, value: value1
> Sep 15, 2015 7:26:00 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
> INFO: Adding key: key2, value: value2
> Sep 15, 2015 7:26:00 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
> INFO: Adding key: key3, value: value3
>
> it works. The only way JCache providers seem to work correctly is loading
> configuration from default classpath.
>
> On Tue, Sep 15, 2015 at 5:00 PM, Romain Manni-Bucau <rmannibucau@gmail.com
> >
> wrote:
>
> > looks like behaving correctly according your config which is initialized
> by
> > the backing JCS cache manager - not the JCache facade one.
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <http://rmannibucau.wordpress.com> | Github <
> > https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com>
> >
> > 2015-09-15 12:44 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
> >
> > > It's there https://github.com/sgjava/jcache-tomee. CacheBeanTest has
> > been
> > > modified not to use testCache =
> > > cacheBean.getCacheManager().getCache("testCache"), only annotations.
> You
> > > will see from the logging that the default cache is created several
> > times.
> > > This makes no sense. I'll switch back to EHcache and see what it does
> > while
> > > you are looking at the source. UserServiceJCacheTest will fail because
> it
> > > compares cache with cacheBean.getCacheManager().getCache("testCache").
> > >
> > >
> > >
> > >
> > > On Tue, Sep 15, 2015 at 2:35 PM, Romain Manni-Bucau <
> > rmannibucau@gmail.com
> > > >
> > > wrote:
> > >
> > > > can you push it all to github? maybe some semantic issue in our
> > > > communication so would check it on a running example
> > > >
> > > >
> > > > Romain Manni-Bucau
> > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > <http://rmannibucau.wordpress.com> | Github <
> > > > https://github.com/rmannibucau> |
> > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > > <http://www.tomitribe.com>
> > > >
> > > > 2015-09-15 10:48 GMT-07:00 sgjava <sg...@gmail.com>:
> > > >
> > > > > OK, I tried the snapshot again and it still creates a default cache
> > > > trying:
> > > > >
> > > > >     @PostConstruct
> > > > >     public void init() {
> > > > >         log.info("PostConstruct");
> > > > >         cachingProvider = Caching.getCachingProvider();
> > > > >         //cacheManager = cachingProvider.getCacheManager();
> > > > >         log.info("getCacheManager");
> > > > >         cacheManager = cachingProvider.getCacheManager(new File(
> > > > >                 "src/main/resources/jcache.ccf").toURI(),
> > > > >                 Thread.currentThread().getContextClassLoader(),
> > > > > cachingProvider.
> > > > >                 getDefaultProperties());
> > > > >     }
> > > > >
> > > > > It still creates a default cache after calling getCacheManager:
> > > > >
> > > > > Sep 15, 2015 1:49:06 PM com.codeferm.jcache.tomee.CacheBean init
> > > > > *INFO: PostConstruct*
> > > > > Sep 15, 2015 1:49:06 PM com.codeferm.jcache.tomee.CacheBean init
> > > > > *INFO: getCacheManager*
> > > > > Sep 15, 2015 1:49:06 PM
> > > > > org.apache.commons.jcs.utils.threadpool.ThreadPoolManager
> loadConfig
> > > > > INFO: thread_pool.default PoolConfiguration = useBoundary = [true]
> > > > > boundarySize = [2000] maximumPoolSize = [150] minimumPoolSize = [4]
> > > > > keepAliveTime = [300000] whenBlockedPolicy = [RUN] startUpSize =
> [4]
> > > > > Sep 15, 2015 1:49:06 PM
> > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > setDefaultAuxValues
> > > > > INFO: Setting default auxiliaries to null
> > > > > Sep 15, 2015 1:49:06 PM
> > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > parseCompositeCacheAttributes
> > > > > INFO: No special CompositeCacheAttributes class defined for key
> > > > > [jcs.default.cacheattributes], using default class.
> > > > > Sep 15, 2015 1:49:06 PM
> > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > setDefaultCompositeCacheAttributes
> > > > > INFO: setting defaultCompositeCacheAttributes to [ useLateral =
> true,
> > > > > useRemote = true, useDisk = true, maxObjs = 100, maxSpoolPerRun =
> -1,
> > > > > diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> > > > > Sep 15, 2015 1:49:06 PM
> > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > parseElementAttributes
> > > > > INFO: No special ElementAttribute class defined for key
> > > > > [jcs.default.elementattributes], using default class.
> > > > > Sep 15, 2015 1:49:06 PM
> > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > setDefaultElementAttributes
> > > > > INFO: setting defaultElementAttributes to [ IS_LATERAL = true,
> > > IS_SPOOL =
> > > > > true, IS_REMOTE = true, IS_ETERNAL = true, MaxLifeSeconds = -1,
> > > IdleTime
> > > > =
> > > > > -1, CreateTime = 1442339346194, LastAccessTime = 1442339346194,
> > > > > getTimeToLiveSeconds() = -1, createTime = 1442339346194 ]
> > > > > Sep 15, 2015 1:49:06 PM
> > > > >
> > >
> org.apache.commons.jcs.engine.memory.AbstractDoubleLinkedListMemoryCache
> > > > > initialize
> > > > > INFO: initialized MemoryCache for testCache
> > > > > Sep 15, 2015 1:49:06 PM
> > > > > org.apache.commons.jcs.engine.control.CompositeCache
> > > > > <init>
> > > > > INFO: Constructed cache with name [testCache] and cache attributes
> [
> > > > > useLateral = true, useRemote = true, useDisk = true, maxObjs =
> > 200001,
> > > > > maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> > > > > Sep 15, 2015 1:49:06 PM
> > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > parseAuxiliary
> > > > > SEVERE: Could not instantiate auxFactory named "DC".
> > > > > Sep 15, 2015 1:49:06 PM
> > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > parseRegions
> > > > > INFO: Parsed regions [testCache]
> > > > > Sep 15, 2015 1:49:06 PM
> > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > doConfigure
> > > > > INFO: Finished configuration in 13 ms.
> > > > >
> > > > > testCache = cacheBean.getCacheManager().getCache("testCache") also
> > > > creates
> > > > > a
> > > > > default cache.
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > View this message in context:
> > > > >
> > > >
> > >
> >
> http://tomee-openejb.979440.n4.nabble.com/JCache-annotations-using-default-cache-instead-of-MutableConfiguration-or-configuration-file-tp4676198p4676225.html
> > > > > Sent from the TomEE Users mailing list archive at Nabble.com.
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Steven P. Goldsmith
> > >
> >
>
>
>
> --
> Steven P. Goldsmith
>

Re: JCache annotations using default cache instead of MutableConfiguration or configuration file

Posted by Steve Goldsmith <sg...@gmail.com>.
OK, maybe it's easier to explain what I'm looking for and you can recommend
the correct JCache way of doing things. I want to use a named cache
initialized by a configuration file. The named cache should be considered a
Singleton, since I should be able to share it between applications and
especially method invocations. I did another commit that moved the
configuration files out of the main and test classpath. This resulted in
the cache not initializing for each test method. For each test using
Ehcache provider I see (using annotations):

WARNING: No Cache named 'testCache' was found in the CacheManager, a
default cache will be created.

I do not want the default cache, I want testCache. Also the @CacheResult
method isn't working correctly since it's adding the came key again:

cacheManager = cachingProvider.getCacheManager(new
File("src/config/ehcache.xml").toURI(), null, null);

Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean
invalidateCache
INFO: Cache invalidated
Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
INFO: Adding key: key1, value: value1
Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
INFO: Adding key: key2, value: value2
Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
INFO: Adding key: key3, value: value3
Sep 15, 2015 7:14:51 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
INFO: Adding key: key1, value: value1

but if I do:

cacheManager = cachingProvider.getCacheManager() with ehcache.xml in
src/main/resources

Sep 15, 2015 7:26:00 PM com.codeferm.jcache.tomee.KeyValueBean
invalidateCache
INFO: Cache invalidated
Sep 15, 2015 7:26:00 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
INFO: Adding key: key1, value: value1
Sep 15, 2015 7:26:00 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
INFO: Adding key: key2, value: value2
Sep 15, 2015 7:26:00 PM com.codeferm.jcache.tomee.KeyValueBean slowMethod
INFO: Adding key: key3, value: value3

it works. The only way JCache providers seem to work correctly is loading
configuration from default classpath.

On Tue, Sep 15, 2015 at 5:00 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> looks like behaving correctly according your config which is initialized by
> the backing JCS cache manager - not the JCache facade one.
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>
> 2015-09-15 12:44 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
>
> > It's there https://github.com/sgjava/jcache-tomee. CacheBeanTest has
> been
> > modified not to use testCache =
> > cacheBean.getCacheManager().getCache("testCache"), only annotations. You
> > will see from the logging that the default cache is created several
> times.
> > This makes no sense. I'll switch back to EHcache and see what it does
> while
> > you are looking at the source. UserServiceJCacheTest will fail because it
> > compares cache with cacheBean.getCacheManager().getCache("testCache").
> >
> >
> >
> >
> > On Tue, Sep 15, 2015 at 2:35 PM, Romain Manni-Bucau <
> rmannibucau@gmail.com
> > >
> > wrote:
> >
> > > can you push it all to github? maybe some semantic issue in our
> > > communication so would check it on a running example
> > >
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > <http://rmannibucau.wordpress.com> | Github <
> > > https://github.com/rmannibucau> |
> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > <http://www.tomitribe.com>
> > >
> > > 2015-09-15 10:48 GMT-07:00 sgjava <sg...@gmail.com>:
> > >
> > > > OK, I tried the snapshot again and it still creates a default cache
> > > trying:
> > > >
> > > >     @PostConstruct
> > > >     public void init() {
> > > >         log.info("PostConstruct");
> > > >         cachingProvider = Caching.getCachingProvider();
> > > >         //cacheManager = cachingProvider.getCacheManager();
> > > >         log.info("getCacheManager");
> > > >         cacheManager = cachingProvider.getCacheManager(new File(
> > > >                 "src/main/resources/jcache.ccf").toURI(),
> > > >                 Thread.currentThread().getContextClassLoader(),
> > > > cachingProvider.
> > > >                 getDefaultProperties());
> > > >     }
> > > >
> > > > It still creates a default cache after calling getCacheManager:
> > > >
> > > > Sep 15, 2015 1:49:06 PM com.codeferm.jcache.tomee.CacheBean init
> > > > *INFO: PostConstruct*
> > > > Sep 15, 2015 1:49:06 PM com.codeferm.jcache.tomee.CacheBean init
> > > > *INFO: getCacheManager*
> > > > Sep 15, 2015 1:49:06 PM
> > > > org.apache.commons.jcs.utils.threadpool.ThreadPoolManager loadConfig
> > > > INFO: thread_pool.default PoolConfiguration = useBoundary = [true]
> > > > boundarySize = [2000] maximumPoolSize = [150] minimumPoolSize = [4]
> > > > keepAliveTime = [300000] whenBlockedPolicy = [RUN] startUpSize = [4]
> > > > Sep 15, 2015 1:49:06 PM
> > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > setDefaultAuxValues
> > > > INFO: Setting default auxiliaries to null
> > > > Sep 15, 2015 1:49:06 PM
> > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > parseCompositeCacheAttributes
> > > > INFO: No special CompositeCacheAttributes class defined for key
> > > > [jcs.default.cacheattributes], using default class.
> > > > Sep 15, 2015 1:49:06 PM
> > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > setDefaultCompositeCacheAttributes
> > > > INFO: setting defaultCompositeCacheAttributes to [ useLateral = true,
> > > > useRemote = true, useDisk = true, maxObjs = 100, maxSpoolPerRun = -1,
> > > > diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> > > > Sep 15, 2015 1:49:06 PM
> > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > parseElementAttributes
> > > > INFO: No special ElementAttribute class defined for key
> > > > [jcs.default.elementattributes], using default class.
> > > > Sep 15, 2015 1:49:06 PM
> > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > setDefaultElementAttributes
> > > > INFO: setting defaultElementAttributes to [ IS_LATERAL = true,
> > IS_SPOOL =
> > > > true, IS_REMOTE = true, IS_ETERNAL = true, MaxLifeSeconds = -1,
> > IdleTime
> > > =
> > > > -1, CreateTime = 1442339346194, LastAccessTime = 1442339346194,
> > > > getTimeToLiveSeconds() = -1, createTime = 1442339346194 ]
> > > > Sep 15, 2015 1:49:06 PM
> > > >
> > org.apache.commons.jcs.engine.memory.AbstractDoubleLinkedListMemoryCache
> > > > initialize
> > > > INFO: initialized MemoryCache for testCache
> > > > Sep 15, 2015 1:49:06 PM
> > > > org.apache.commons.jcs.engine.control.CompositeCache
> > > > <init>
> > > > INFO: Constructed cache with name [testCache] and cache attributes [
> > > > useLateral = true, useRemote = true, useDisk = true, maxObjs =
> 200001,
> > > > maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> > > > Sep 15, 2015 1:49:06 PM
> > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > parseAuxiliary
> > > > SEVERE: Could not instantiate auxFactory named "DC".
> > > > Sep 15, 2015 1:49:06 PM
> > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > parseRegions
> > > > INFO: Parsed regions [testCache]
> > > > Sep 15, 2015 1:49:06 PM
> > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > doConfigure
> > > > INFO: Finished configuration in 13 ms.
> > > >
> > > > testCache = cacheBean.getCacheManager().getCache("testCache") also
> > > creates
> > > > a
> > > > default cache.
> > > >
> > > >
> > > >
> > > > --
> > > > View this message in context:
> > > >
> > >
> >
> http://tomee-openejb.979440.n4.nabble.com/JCache-annotations-using-default-cache-instead-of-MutableConfiguration-or-configuration-file-tp4676198p4676225.html
> > > > Sent from the TomEE Users mailing list archive at Nabble.com.
> > > >
> > >
> >
> >
> >
> > --
> > Steven P. Goldsmith
> >
>



-- 
Steven P. Goldsmith

Re: JCache annotations using default cache instead of MutableConfiguration or configuration file

Posted by Romain Manni-Bucau <rm...@gmail.com>.
looks like behaving correctly according your config which is initialized by
the backing JCS cache manager - not the JCache facade one.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-09-15 12:44 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:

> It's there https://github.com/sgjava/jcache-tomee. CacheBeanTest has been
> modified not to use testCache =
> cacheBean.getCacheManager().getCache("testCache"), only annotations. You
> will see from the logging that the default cache is created several times.
> This makes no sense. I'll switch back to EHcache and see what it does while
> you are looking at the source. UserServiceJCacheTest will fail because it
> compares cache with cacheBean.getCacheManager().getCache("testCache").
>
>
>
>
> On Tue, Sep 15, 2015 at 2:35 PM, Romain Manni-Bucau <rmannibucau@gmail.com
> >
> wrote:
>
> > can you push it all to github? maybe some semantic issue in our
> > communication so would check it on a running example
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <http://rmannibucau.wordpress.com> | Github <
> > https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com>
> >
> > 2015-09-15 10:48 GMT-07:00 sgjava <sg...@gmail.com>:
> >
> > > OK, I tried the snapshot again and it still creates a default cache
> > trying:
> > >
> > >     @PostConstruct
> > >     public void init() {
> > >         log.info("PostConstruct");
> > >         cachingProvider = Caching.getCachingProvider();
> > >         //cacheManager = cachingProvider.getCacheManager();
> > >         log.info("getCacheManager");
> > >         cacheManager = cachingProvider.getCacheManager(new File(
> > >                 "src/main/resources/jcache.ccf").toURI(),
> > >                 Thread.currentThread().getContextClassLoader(),
> > > cachingProvider.
> > >                 getDefaultProperties());
> > >     }
> > >
> > > It still creates a default cache after calling getCacheManager:
> > >
> > > Sep 15, 2015 1:49:06 PM com.codeferm.jcache.tomee.CacheBean init
> > > *INFO: PostConstruct*
> > > Sep 15, 2015 1:49:06 PM com.codeferm.jcache.tomee.CacheBean init
> > > *INFO: getCacheManager*
> > > Sep 15, 2015 1:49:06 PM
> > > org.apache.commons.jcs.utils.threadpool.ThreadPoolManager loadConfig
> > > INFO: thread_pool.default PoolConfiguration = useBoundary = [true]
> > > boundarySize = [2000] maximumPoolSize = [150] minimumPoolSize = [4]
> > > keepAliveTime = [300000] whenBlockedPolicy = [RUN] startUpSize = [4]
> > > Sep 15, 2015 1:49:06 PM
> > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > setDefaultAuxValues
> > > INFO: Setting default auxiliaries to null
> > > Sep 15, 2015 1:49:06 PM
> > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > parseCompositeCacheAttributes
> > > INFO: No special CompositeCacheAttributes class defined for key
> > > [jcs.default.cacheattributes], using default class.
> > > Sep 15, 2015 1:49:06 PM
> > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > setDefaultCompositeCacheAttributes
> > > INFO: setting defaultCompositeCacheAttributes to [ useLateral = true,
> > > useRemote = true, useDisk = true, maxObjs = 100, maxSpoolPerRun = -1,
> > > diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> > > Sep 15, 2015 1:49:06 PM
> > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > parseElementAttributes
> > > INFO: No special ElementAttribute class defined for key
> > > [jcs.default.elementattributes], using default class.
> > > Sep 15, 2015 1:49:06 PM
> > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > setDefaultElementAttributes
> > > INFO: setting defaultElementAttributes to [ IS_LATERAL = true,
> IS_SPOOL =
> > > true, IS_REMOTE = true, IS_ETERNAL = true, MaxLifeSeconds = -1,
> IdleTime
> > =
> > > -1, CreateTime = 1442339346194, LastAccessTime = 1442339346194,
> > > getTimeToLiveSeconds() = -1, createTime = 1442339346194 ]
> > > Sep 15, 2015 1:49:06 PM
> > >
> org.apache.commons.jcs.engine.memory.AbstractDoubleLinkedListMemoryCache
> > > initialize
> > > INFO: initialized MemoryCache for testCache
> > > Sep 15, 2015 1:49:06 PM
> > > org.apache.commons.jcs.engine.control.CompositeCache
> > > <init>
> > > INFO: Constructed cache with name [testCache] and cache attributes [
> > > useLateral = true, useRemote = true, useDisk = true, maxObjs = 200001,
> > > maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> > > Sep 15, 2015 1:49:06 PM
> > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > parseAuxiliary
> > > SEVERE: Could not instantiate auxFactory named "DC".
> > > Sep 15, 2015 1:49:06 PM
> > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > parseRegions
> > > INFO: Parsed regions [testCache]
> > > Sep 15, 2015 1:49:06 PM
> > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > doConfigure
> > > INFO: Finished configuration in 13 ms.
> > >
> > > testCache = cacheBean.getCacheManager().getCache("testCache") also
> > creates
> > > a
> > > default cache.
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://tomee-openejb.979440.n4.nabble.com/JCache-annotations-using-default-cache-instead-of-MutableConfiguration-or-configuration-file-tp4676198p4676225.html
> > > Sent from the TomEE Users mailing list archive at Nabble.com.
> > >
> >
>
>
>
> --
> Steven P. Goldsmith
>

Re: JCache annotations using default cache instead of MutableConfiguration or configuration file

Posted by Steve Goldsmith <sg...@gmail.com>.
It's there https://github.com/sgjava/jcache-tomee. CacheBeanTest has been
modified not to use testCache =
cacheBean.getCacheManager().getCache("testCache"), only annotations. You
will see from the logging that the default cache is created several times.
This makes no sense. I'll switch back to EHcache and see what it does while
you are looking at the source. UserServiceJCacheTest will fail because it
compares cache with cacheBean.getCacheManager().getCache("testCache").




On Tue, Sep 15, 2015 at 2:35 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> can you push it all to github? maybe some semantic issue in our
> communication so would check it on a running example
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>
> 2015-09-15 10:48 GMT-07:00 sgjava <sg...@gmail.com>:
>
> > OK, I tried the snapshot again and it still creates a default cache
> trying:
> >
> >     @PostConstruct
> >     public void init() {
> >         log.info("PostConstruct");
> >         cachingProvider = Caching.getCachingProvider();
> >         //cacheManager = cachingProvider.getCacheManager();
> >         log.info("getCacheManager");
> >         cacheManager = cachingProvider.getCacheManager(new File(
> >                 "src/main/resources/jcache.ccf").toURI(),
> >                 Thread.currentThread().getContextClassLoader(),
> > cachingProvider.
> >                 getDefaultProperties());
> >     }
> >
> > It still creates a default cache after calling getCacheManager:
> >
> > Sep 15, 2015 1:49:06 PM com.codeferm.jcache.tomee.CacheBean init
> > *INFO: PostConstruct*
> > Sep 15, 2015 1:49:06 PM com.codeferm.jcache.tomee.CacheBean init
> > *INFO: getCacheManager*
> > Sep 15, 2015 1:49:06 PM
> > org.apache.commons.jcs.utils.threadpool.ThreadPoolManager loadConfig
> > INFO: thread_pool.default PoolConfiguration = useBoundary = [true]
> > boundarySize = [2000] maximumPoolSize = [150] minimumPoolSize = [4]
> > keepAliveTime = [300000] whenBlockedPolicy = [RUN] startUpSize = [4]
> > Sep 15, 2015 1:49:06 PM
> > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > setDefaultAuxValues
> > INFO: Setting default auxiliaries to null
> > Sep 15, 2015 1:49:06 PM
> > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > parseCompositeCacheAttributes
> > INFO: No special CompositeCacheAttributes class defined for key
> > [jcs.default.cacheattributes], using default class.
> > Sep 15, 2015 1:49:06 PM
> > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > setDefaultCompositeCacheAttributes
> > INFO: setting defaultCompositeCacheAttributes to [ useLateral = true,
> > useRemote = true, useDisk = true, maxObjs = 100, maxSpoolPerRun = -1,
> > diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> > Sep 15, 2015 1:49:06 PM
> > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > parseElementAttributes
> > INFO: No special ElementAttribute class defined for key
> > [jcs.default.elementattributes], using default class.
> > Sep 15, 2015 1:49:06 PM
> > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > setDefaultElementAttributes
> > INFO: setting defaultElementAttributes to [ IS_LATERAL = true, IS_SPOOL =
> > true, IS_REMOTE = true, IS_ETERNAL = true, MaxLifeSeconds = -1, IdleTime
> =
> > -1, CreateTime = 1442339346194, LastAccessTime = 1442339346194,
> > getTimeToLiveSeconds() = -1, createTime = 1442339346194 ]
> > Sep 15, 2015 1:49:06 PM
> > org.apache.commons.jcs.engine.memory.AbstractDoubleLinkedListMemoryCache
> > initialize
> > INFO: initialized MemoryCache for testCache
> > Sep 15, 2015 1:49:06 PM
> > org.apache.commons.jcs.engine.control.CompositeCache
> > <init>
> > INFO: Constructed cache with name [testCache] and cache attributes [
> > useLateral = true, useRemote = true, useDisk = true, maxObjs = 200001,
> > maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> > Sep 15, 2015 1:49:06 PM
> > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > parseAuxiliary
> > SEVERE: Could not instantiate auxFactory named "DC".
> > Sep 15, 2015 1:49:06 PM
> > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > parseRegions
> > INFO: Parsed regions [testCache]
> > Sep 15, 2015 1:49:06 PM
> > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > doConfigure
> > INFO: Finished configuration in 13 ms.
> >
> > testCache = cacheBean.getCacheManager().getCache("testCache") also
> creates
> > a
> > default cache.
> >
> >
> >
> > --
> > View this message in context:
> >
> http://tomee-openejb.979440.n4.nabble.com/JCache-annotations-using-default-cache-instead-of-MutableConfiguration-or-configuration-file-tp4676198p4676225.html
> > Sent from the TomEE Users mailing list archive at Nabble.com.
> >
>



-- 
Steven P. Goldsmith

Re: JCache annotations using default cache instead of MutableConfiguration or configuration file

Posted by Romain Manni-Bucau <rm...@gmail.com>.
can you push it all to github? maybe some semantic issue in our
communication so would check it on a running example


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-09-15 10:48 GMT-07:00 sgjava <sg...@gmail.com>:

> OK, I tried the snapshot again and it still creates a default cache trying:
>
>     @PostConstruct
>     public void init() {
>         log.info("PostConstruct");
>         cachingProvider = Caching.getCachingProvider();
>         //cacheManager = cachingProvider.getCacheManager();
>         log.info("getCacheManager");
>         cacheManager = cachingProvider.getCacheManager(new File(
>                 "src/main/resources/jcache.ccf").toURI(),
>                 Thread.currentThread().getContextClassLoader(),
> cachingProvider.
>                 getDefaultProperties());
>     }
>
> It still creates a default cache after calling getCacheManager:
>
> Sep 15, 2015 1:49:06 PM com.codeferm.jcache.tomee.CacheBean init
> *INFO: PostConstruct*
> Sep 15, 2015 1:49:06 PM com.codeferm.jcache.tomee.CacheBean init
> *INFO: getCacheManager*
> Sep 15, 2015 1:49:06 PM
> org.apache.commons.jcs.utils.threadpool.ThreadPoolManager loadConfig
> INFO: thread_pool.default PoolConfiguration = useBoundary = [true]
> boundarySize = [2000] maximumPoolSize = [150] minimumPoolSize = [4]
> keepAliveTime = [300000] whenBlockedPolicy = [RUN] startUpSize = [4]
> Sep 15, 2015 1:49:06 PM
> org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> setDefaultAuxValues
> INFO: Setting default auxiliaries to null
> Sep 15, 2015 1:49:06 PM
> org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> parseCompositeCacheAttributes
> INFO: No special CompositeCacheAttributes class defined for key
> [jcs.default.cacheattributes], using default class.
> Sep 15, 2015 1:49:06 PM
> org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> setDefaultCompositeCacheAttributes
> INFO: setting defaultCompositeCacheAttributes to [ useLateral = true,
> useRemote = true, useDisk = true, maxObjs = 100, maxSpoolPerRun = -1,
> diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> Sep 15, 2015 1:49:06 PM
> org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> parseElementAttributes
> INFO: No special ElementAttribute class defined for key
> [jcs.default.elementattributes], using default class.
> Sep 15, 2015 1:49:06 PM
> org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> setDefaultElementAttributes
> INFO: setting defaultElementAttributes to [ IS_LATERAL = true, IS_SPOOL =
> true, IS_REMOTE = true, IS_ETERNAL = true, MaxLifeSeconds = -1, IdleTime =
> -1, CreateTime = 1442339346194, LastAccessTime = 1442339346194,
> getTimeToLiveSeconds() = -1, createTime = 1442339346194 ]
> Sep 15, 2015 1:49:06 PM
> org.apache.commons.jcs.engine.memory.AbstractDoubleLinkedListMemoryCache
> initialize
> INFO: initialized MemoryCache for testCache
> Sep 15, 2015 1:49:06 PM
> org.apache.commons.jcs.engine.control.CompositeCache
> <init>
> INFO: Constructed cache with name [testCache] and cache attributes [
> useLateral = true, useRemote = true, useDisk = true, maxObjs = 200001,
> maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> Sep 15, 2015 1:49:06 PM
> org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> parseAuxiliary
> SEVERE: Could not instantiate auxFactory named "DC".
> Sep 15, 2015 1:49:06 PM
> org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> parseRegions
> INFO: Parsed regions [testCache]
> Sep 15, 2015 1:49:06 PM
> org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> doConfigure
> INFO: Finished configuration in 13 ms.
>
> testCache = cacheBean.getCacheManager().getCache("testCache") also creates
> a
> default cache.
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/JCache-annotations-using-default-cache-instead-of-MutableConfiguration-or-configuration-file-tp4676198p4676225.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: JCache annotations using default cache instead of MutableConfiguration or configuration file

Posted by sgjava <sg...@gmail.com>.
OK, I tried the snapshot again and it still creates a default cache trying:

    @PostConstruct
    public void init() {
        log.info("PostConstruct");
        cachingProvider = Caching.getCachingProvider();
        //cacheManager = cachingProvider.getCacheManager();
        log.info("getCacheManager");
        cacheManager = cachingProvider.getCacheManager(new File(
                "src/main/resources/jcache.ccf").toURI(),
                Thread.currentThread().getContextClassLoader(),
cachingProvider.
                getDefaultProperties());
    }

It still creates a default cache after calling getCacheManager:

Sep 15, 2015 1:49:06 PM com.codeferm.jcache.tomee.CacheBean init
*INFO: PostConstruct*
Sep 15, 2015 1:49:06 PM com.codeferm.jcache.tomee.CacheBean init
*INFO: getCacheManager*
Sep 15, 2015 1:49:06 PM
org.apache.commons.jcs.utils.threadpool.ThreadPoolManager loadConfig
INFO: thread_pool.default PoolConfiguration = useBoundary = [true]
boundarySize = [2000] maximumPoolSize = [150] minimumPoolSize = [4]
keepAliveTime = [300000] whenBlockedPolicy = [RUN] startUpSize = [4]
Sep 15, 2015 1:49:06 PM
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
setDefaultAuxValues
INFO: Setting default auxiliaries to null
Sep 15, 2015 1:49:06 PM
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
parseCompositeCacheAttributes
INFO: No special CompositeCacheAttributes class defined for key
[jcs.default.cacheattributes], using default class.
Sep 15, 2015 1:49:06 PM
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
setDefaultCompositeCacheAttributes
INFO: setting defaultCompositeCacheAttributes to [ useLateral = true,
useRemote = true, useDisk = true, maxObjs = 100, maxSpoolPerRun = -1,
diskUsagePattern = SWAP, spoolChunkSize = 2 ]
Sep 15, 2015 1:49:06 PM
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
parseElementAttributes
INFO: No special ElementAttribute class defined for key
[jcs.default.elementattributes], using default class.
Sep 15, 2015 1:49:06 PM
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
setDefaultElementAttributes
INFO: setting defaultElementAttributes to [ IS_LATERAL = true, IS_SPOOL =
true, IS_REMOTE = true, IS_ETERNAL = true, MaxLifeSeconds = -1, IdleTime =
-1, CreateTime = 1442339346194, LastAccessTime = 1442339346194,
getTimeToLiveSeconds() = -1, createTime = 1442339346194 ]
Sep 15, 2015 1:49:06 PM
org.apache.commons.jcs.engine.memory.AbstractDoubleLinkedListMemoryCache
initialize
INFO: initialized MemoryCache for testCache
Sep 15, 2015 1:49:06 PM org.apache.commons.jcs.engine.control.CompositeCache
<init>
INFO: Constructed cache with name [testCache] and cache attributes [
useLateral = true, useRemote = true, useDisk = true, maxObjs = 200001,
maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
Sep 15, 2015 1:49:06 PM
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
parseAuxiliary
SEVERE: Could not instantiate auxFactory named "DC".
Sep 15, 2015 1:49:06 PM
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
parseRegions
INFO: Parsed regions [testCache]
Sep 15, 2015 1:49:06 PM
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator doConfigure
INFO: Finished configuration in 13 ms.

testCache = cacheBean.getCacheManager().getCache("testCache") also creates a
default cache.



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/JCache-annotations-using-default-cache-instead-of-MutableConfiguration-or-configuration-file-tp4676198p4676225.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: JCache annotations using default cache instead of MutableConfiguration or configuration file

Posted by Romain Manni-Bucau <rm...@gmail.com>.
this is a manual deploy AFAIK - maybe I missed an automatic job here, just
did run it now.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-09-14 11:36 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:

> OK, what time EDT does the SNAPSHOT build complete?
>
> On Mon, Sep 14, 2015 at 2:02 PM, Romain Manni-Bucau <rmannibucau@gmail.com
> >
> wrote:
>
> > should work AFAIK, maybe update your project adding a test failling in
> the
> > case you meet and I'll try to check tonight
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <http://rmannibucau.wordpress.com> | Github <
> > https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com>
> >
> > 2015-09-14 10:51 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
> >
> > > OK, I'm using commons-jcs-jcache 2.0-SNAPSHOT as of today and this is
> the
> > > behavior I'm getting. What I'd like if for getCacheManager(new
> > >
> > >
> >
> File("src/main/resources/jcache.ccf").toURI(),Thread.currentThread().getContextClassLoader(),
> > > cachingProvider.             getDefaultProperties()) to work with
> > > @CacheDefaults(cacheName = "testCache").
> > >
> > > Which release should I use?
> > >
> > > jcs.region.testCache=DC
> > >
> > >
> >
> jcs.region.testCache.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
> > > jcs.region.testCache.cacheattributes.MaxObjects=200001
> > >
> > >
> >
> jcs.region.testCache.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache
> > > jcs.region.testCache.cacheattributes.UseMemoryShrinker=true
> > > jcs.region.testCache.cacheattributes.MaxMemoryIdleTimeSeconds=3600
> > > jcs.region.testCache.cacheattributes.ShrinkerIntervalSeconds=60
> > >
> > >
> >
> jcs.region.testCache.elementattributes=org.apache.commons.jcs.engine.ElementAttributes
> > > jcs.region.testCache.elementattributes.IsEternal=false
> > > jcs.region.testCache.elementattributes.MaxLife=600
> > > jcs.region.testCache.elementattributes.IdleTime=1800
> > > jcs.region.testCache.elementattributes.IsSpool=true
> > > jcs.region.testCache.elementattributes.IsRemote=true
> > > jcs.region.testCache.elementattributes.IsLateral=true
> > >
> > > On Mon, Sep 14, 2015 at 1:20 PM, Romain Manni-Bucau <
> > rmannibucau@gmail.com
> > > >
> > > wrote:
> > >
> > > > Hi
> > > >
> > > > not with the snapshot normally but in last available release yes -
> has
> > > been
> > > > fixed in between
> > > >
> > > >
> > > > Romain Manni-Bucau
> > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > <http://rmannibucau.wordpress.com> | Github <
> > > > https://github.com/rmannibucau> |
> > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > > <http://www.tomitribe.com>
> > > >
> > > > 2015-09-14 10:09 GMT-07:00 sgjava <sg...@gmail.com>:
> > > >
> > > > > It looks like JCache (commons-jcs) is creating a default cache even
> > > > though
> > > > > I
> > > > > use:
> > > > >
> > > > > @CacheDefaults(cacheName = "testCache", cacheKeyGenerator
> > > > >         = StringKeyGenerator.class)
> > > > >
> > > > > Even if I use:
> > > > >
> > > > >         cacheManager = cachingProvider.getCacheManager(new File(
> > > > >                 "src/main/resources/jcache.ccf").toURI(),
> > > > >                 Thread.currentThread().getContextClassLoader(),
> > > > > cachingProvider.
> > > > >                 getDefaultProperties());
> > > > >         MutableConfiguration<StringGeneratedCacheKey, String>
> config
> > > > >                 = new MutableConfiguration<>();
> > > > >
>  config.setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(
> > > > >                 new Duration(TimeUnit.MINUTES, 10)));
> > > > >         cache = cacheManager.createCache("testCache", config);
> > > > >
> > > > > In the logs I see both caches being created:
> > > > >
> > > > > Using getCacheManager:
> > > > >
> > > > > INFO: initialized MemoryCache for testCache
> > > > > Sep 14, 2015 1:07:58 PM
> > > > > org.apache.commons.jcs.engine.control.CompositeCache
> > > > > <init>
> > > > > INFO: Constructed cache with name [testCache] and cache attributes
> [
> > > > > useLateral = true, useRemote = true, useDisk = true, maxObjs =
> > 200001,
> > > > > maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> > > > > Sep 14, 2015 1:07:58 PM
> > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > parseAuxiliary
> > > > > SEVERE: Could not instantiate auxFactory named "DC".
> > > > > Sep 14, 2015 1:07:58 PM
> > > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > > parseRegions
> > > > > INFO: Parsed regions [testCache]
> > > > >
> > > > > Then the default version:
> > > > >
> > > > > INFO: initialized MemoryCache for testCache
> > > > > Sep 14, 2015 1:07:58 PM
> > > > > org.apache.commons.jcs.engine.control.CompositeCache
> > > > > <init>
> > > > > INFO: Constructed cache with name [testCache] and cache attributes
> [
> > > > > useLateral = true, useRemote = true, useDisk = true, maxObjs = 100,
> > > > > maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> > > > >
> > > > > The annotations are using athe default configuration.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > View this message in context:
> > > > >
> > > >
> > >
> >
> http://tomee-openejb.979440.n4.nabble.com/JCache-annotations-using-default-cache-instead-of-MutableConfiguration-or-configuration-file-tp4676198.html
> > > > > Sent from the TomEE Users mailing list archive at Nabble.com.
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Steven P. Goldsmith
> > >
> >
>
>
>
> --
> Steven P. Goldsmith
>

Re: JCache annotations using default cache instead of MutableConfiguration or configuration file

Posted by Steve Goldsmith <sg...@gmail.com>.
OK, what time EDT does the SNAPSHOT build complete?

On Mon, Sep 14, 2015 at 2:02 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> should work AFAIK, maybe update your project adding a test failling in the
> case you meet and I'll try to check tonight
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>
> 2015-09-14 10:51 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
>
> > OK, I'm using commons-jcs-jcache 2.0-SNAPSHOT as of today and this is the
> > behavior I'm getting. What I'd like if for getCacheManager(new
> >
> >
> File("src/main/resources/jcache.ccf").toURI(),Thread.currentThread().getContextClassLoader(),
> > cachingProvider.             getDefaultProperties()) to work with
> > @CacheDefaults(cacheName = "testCache").
> >
> > Which release should I use?
> >
> > jcs.region.testCache=DC
> >
> >
> jcs.region.testCache.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
> > jcs.region.testCache.cacheattributes.MaxObjects=200001
> >
> >
> jcs.region.testCache.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache
> > jcs.region.testCache.cacheattributes.UseMemoryShrinker=true
> > jcs.region.testCache.cacheattributes.MaxMemoryIdleTimeSeconds=3600
> > jcs.region.testCache.cacheattributes.ShrinkerIntervalSeconds=60
> >
> >
> jcs.region.testCache.elementattributes=org.apache.commons.jcs.engine.ElementAttributes
> > jcs.region.testCache.elementattributes.IsEternal=false
> > jcs.region.testCache.elementattributes.MaxLife=600
> > jcs.region.testCache.elementattributes.IdleTime=1800
> > jcs.region.testCache.elementattributes.IsSpool=true
> > jcs.region.testCache.elementattributes.IsRemote=true
> > jcs.region.testCache.elementattributes.IsLateral=true
> >
> > On Mon, Sep 14, 2015 at 1:20 PM, Romain Manni-Bucau <
> rmannibucau@gmail.com
> > >
> > wrote:
> >
> > > Hi
> > >
> > > not with the snapshot normally but in last available release yes - has
> > been
> > > fixed in between
> > >
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > <http://rmannibucau.wordpress.com> | Github <
> > > https://github.com/rmannibucau> |
> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > <http://www.tomitribe.com>
> > >
> > > 2015-09-14 10:09 GMT-07:00 sgjava <sg...@gmail.com>:
> > >
> > > > It looks like JCache (commons-jcs) is creating a default cache even
> > > though
> > > > I
> > > > use:
> > > >
> > > > @CacheDefaults(cacheName = "testCache", cacheKeyGenerator
> > > >         = StringKeyGenerator.class)
> > > >
> > > > Even if I use:
> > > >
> > > >         cacheManager = cachingProvider.getCacheManager(new File(
> > > >                 "src/main/resources/jcache.ccf").toURI(),
> > > >                 Thread.currentThread().getContextClassLoader(),
> > > > cachingProvider.
> > > >                 getDefaultProperties());
> > > >         MutableConfiguration<StringGeneratedCacheKey, String> config
> > > >                 = new MutableConfiguration<>();
> > > >         config.setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(
> > > >                 new Duration(TimeUnit.MINUTES, 10)));
> > > >         cache = cacheManager.createCache("testCache", config);
> > > >
> > > > In the logs I see both caches being created:
> > > >
> > > > Using getCacheManager:
> > > >
> > > > INFO: initialized MemoryCache for testCache
> > > > Sep 14, 2015 1:07:58 PM
> > > > org.apache.commons.jcs.engine.control.CompositeCache
> > > > <init>
> > > > INFO: Constructed cache with name [testCache] and cache attributes [
> > > > useLateral = true, useRemote = true, useDisk = true, maxObjs =
> 200001,
> > > > maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> > > > Sep 14, 2015 1:07:58 PM
> > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > parseAuxiliary
> > > > SEVERE: Could not instantiate auxFactory named "DC".
> > > > Sep 14, 2015 1:07:58 PM
> > > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > > parseRegions
> > > > INFO: Parsed regions [testCache]
> > > >
> > > > Then the default version:
> > > >
> > > > INFO: initialized MemoryCache for testCache
> > > > Sep 14, 2015 1:07:58 PM
> > > > org.apache.commons.jcs.engine.control.CompositeCache
> > > > <init>
> > > > INFO: Constructed cache with name [testCache] and cache attributes [
> > > > useLateral = true, useRemote = true, useDisk = true, maxObjs = 100,
> > > > maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> > > >
> > > > The annotations are using athe default configuration.
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > View this message in context:
> > > >
> > >
> >
> http://tomee-openejb.979440.n4.nabble.com/JCache-annotations-using-default-cache-instead-of-MutableConfiguration-or-configuration-file-tp4676198.html
> > > > Sent from the TomEE Users mailing list archive at Nabble.com.
> > > >
> > >
> >
> >
> >
> > --
> > Steven P. Goldsmith
> >
>



-- 
Steven P. Goldsmith

Re: JCache annotations using default cache instead of MutableConfiguration or configuration file

Posted by Romain Manni-Bucau <rm...@gmail.com>.
should work AFAIK, maybe update your project adding a test failling in the
case you meet and I'll try to check tonight


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-09-14 10:51 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:

> OK, I'm using commons-jcs-jcache 2.0-SNAPSHOT as of today and this is the
> behavior I'm getting. What I'd like if for getCacheManager(new
>
> File("src/main/resources/jcache.ccf").toURI(),Thread.currentThread().getContextClassLoader(),
> cachingProvider.             getDefaultProperties()) to work with
> @CacheDefaults(cacheName = "testCache").
>
> Which release should I use?
>
> jcs.region.testCache=DC
>
> jcs.region.testCache.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
> jcs.region.testCache.cacheattributes.MaxObjects=200001
>
> jcs.region.testCache.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache
> jcs.region.testCache.cacheattributes.UseMemoryShrinker=true
> jcs.region.testCache.cacheattributes.MaxMemoryIdleTimeSeconds=3600
> jcs.region.testCache.cacheattributes.ShrinkerIntervalSeconds=60
>
> jcs.region.testCache.elementattributes=org.apache.commons.jcs.engine.ElementAttributes
> jcs.region.testCache.elementattributes.IsEternal=false
> jcs.region.testCache.elementattributes.MaxLife=600
> jcs.region.testCache.elementattributes.IdleTime=1800
> jcs.region.testCache.elementattributes.IsSpool=true
> jcs.region.testCache.elementattributes.IsRemote=true
> jcs.region.testCache.elementattributes.IsLateral=true
>
> On Mon, Sep 14, 2015 at 1:20 PM, Romain Manni-Bucau <rmannibucau@gmail.com
> >
> wrote:
>
> > Hi
> >
> > not with the snapshot normally but in last available release yes - has
> been
> > fixed in between
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <http://rmannibucau.wordpress.com> | Github <
> > https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com>
> >
> > 2015-09-14 10:09 GMT-07:00 sgjava <sg...@gmail.com>:
> >
> > > It looks like JCache (commons-jcs) is creating a default cache even
> > though
> > > I
> > > use:
> > >
> > > @CacheDefaults(cacheName = "testCache", cacheKeyGenerator
> > >         = StringKeyGenerator.class)
> > >
> > > Even if I use:
> > >
> > >         cacheManager = cachingProvider.getCacheManager(new File(
> > >                 "src/main/resources/jcache.ccf").toURI(),
> > >                 Thread.currentThread().getContextClassLoader(),
> > > cachingProvider.
> > >                 getDefaultProperties());
> > >         MutableConfiguration<StringGeneratedCacheKey, String> config
> > >                 = new MutableConfiguration<>();
> > >         config.setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(
> > >                 new Duration(TimeUnit.MINUTES, 10)));
> > >         cache = cacheManager.createCache("testCache", config);
> > >
> > > In the logs I see both caches being created:
> > >
> > > Using getCacheManager:
> > >
> > > INFO: initialized MemoryCache for testCache
> > > Sep 14, 2015 1:07:58 PM
> > > org.apache.commons.jcs.engine.control.CompositeCache
> > > <init>
> > > INFO: Constructed cache with name [testCache] and cache attributes [
> > > useLateral = true, useRemote = true, useDisk = true, maxObjs = 200001,
> > > maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> > > Sep 14, 2015 1:07:58 PM
> > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > parseAuxiliary
> > > SEVERE: Could not instantiate auxFactory named "DC".
> > > Sep 14, 2015 1:07:58 PM
> > > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > > parseRegions
> > > INFO: Parsed regions [testCache]
> > >
> > > Then the default version:
> > >
> > > INFO: initialized MemoryCache for testCache
> > > Sep 14, 2015 1:07:58 PM
> > > org.apache.commons.jcs.engine.control.CompositeCache
> > > <init>
> > > INFO: Constructed cache with name [testCache] and cache attributes [
> > > useLateral = true, useRemote = true, useDisk = true, maxObjs = 100,
> > > maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> > >
> > > The annotations are using athe default configuration.
> > >
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://tomee-openejb.979440.n4.nabble.com/JCache-annotations-using-default-cache-instead-of-MutableConfiguration-or-configuration-file-tp4676198.html
> > > Sent from the TomEE Users mailing list archive at Nabble.com.
> > >
> >
>
>
>
> --
> Steven P. Goldsmith
>

Re: JCache annotations using default cache instead of MutableConfiguration or configuration file

Posted by Steve Goldsmith <sg...@gmail.com>.
OK, I'm using commons-jcs-jcache 2.0-SNAPSHOT as of today and this is the
behavior I'm getting. What I'd like if for getCacheManager(new
File("src/main/resources/jcache.ccf").toURI(),Thread.currentThread().getContextClassLoader(),
cachingProvider.             getDefaultProperties()) to work with
@CacheDefaults(cacheName = "testCache").

Which release should I use?

jcs.region.testCache=DC
jcs.region.testCache.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.region.testCache.cacheattributes.MaxObjects=200001
jcs.region.testCache.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache
jcs.region.testCache.cacheattributes.UseMemoryShrinker=true
jcs.region.testCache.cacheattributes.MaxMemoryIdleTimeSeconds=3600
jcs.region.testCache.cacheattributes.ShrinkerIntervalSeconds=60
jcs.region.testCache.elementattributes=org.apache.commons.jcs.engine.ElementAttributes
jcs.region.testCache.elementattributes.IsEternal=false
jcs.region.testCache.elementattributes.MaxLife=600
jcs.region.testCache.elementattributes.IdleTime=1800
jcs.region.testCache.elementattributes.IsSpool=true
jcs.region.testCache.elementattributes.IsRemote=true
jcs.region.testCache.elementattributes.IsLateral=true

On Mon, Sep 14, 2015 at 1:20 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> Hi
>
> not with the snapshot normally but in last available release yes - has been
> fixed in between
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>
> 2015-09-14 10:09 GMT-07:00 sgjava <sg...@gmail.com>:
>
> > It looks like JCache (commons-jcs) is creating a default cache even
> though
> > I
> > use:
> >
> > @CacheDefaults(cacheName = "testCache", cacheKeyGenerator
> >         = StringKeyGenerator.class)
> >
> > Even if I use:
> >
> >         cacheManager = cachingProvider.getCacheManager(new File(
> >                 "src/main/resources/jcache.ccf").toURI(),
> >                 Thread.currentThread().getContextClassLoader(),
> > cachingProvider.
> >                 getDefaultProperties());
> >         MutableConfiguration<StringGeneratedCacheKey, String> config
> >                 = new MutableConfiguration<>();
> >         config.setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(
> >                 new Duration(TimeUnit.MINUTES, 10)));
> >         cache = cacheManager.createCache("testCache", config);
> >
> > In the logs I see both caches being created:
> >
> > Using getCacheManager:
> >
> > INFO: initialized MemoryCache for testCache
> > Sep 14, 2015 1:07:58 PM
> > org.apache.commons.jcs.engine.control.CompositeCache
> > <init>
> > INFO: Constructed cache with name [testCache] and cache attributes [
> > useLateral = true, useRemote = true, useDisk = true, maxObjs = 200001,
> > maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> > Sep 14, 2015 1:07:58 PM
> > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > parseAuxiliary
> > SEVERE: Could not instantiate auxFactory named "DC".
> > Sep 14, 2015 1:07:58 PM
> > org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> > parseRegions
> > INFO: Parsed regions [testCache]
> >
> > Then the default version:
> >
> > INFO: initialized MemoryCache for testCache
> > Sep 14, 2015 1:07:58 PM
> > org.apache.commons.jcs.engine.control.CompositeCache
> > <init>
> > INFO: Constructed cache with name [testCache] and cache attributes [
> > useLateral = true, useRemote = true, useDisk = true, maxObjs = 100,
> > maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> >
> > The annotations are using athe default configuration.
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://tomee-openejb.979440.n4.nabble.com/JCache-annotations-using-default-cache-instead-of-MutableConfiguration-or-configuration-file-tp4676198.html
> > Sent from the TomEE Users mailing list archive at Nabble.com.
> >
>



-- 
Steven P. Goldsmith

Re: JCache annotations using default cache instead of MutableConfiguration or configuration file

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

not with the snapshot normally but in last available release yes - has been
fixed in between


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-09-14 10:09 GMT-07:00 sgjava <sg...@gmail.com>:

> It looks like JCache (commons-jcs) is creating a default cache even though
> I
> use:
>
> @CacheDefaults(cacheName = "testCache", cacheKeyGenerator
>         = StringKeyGenerator.class)
>
> Even if I use:
>
>         cacheManager = cachingProvider.getCacheManager(new File(
>                 "src/main/resources/jcache.ccf").toURI(),
>                 Thread.currentThread().getContextClassLoader(),
> cachingProvider.
>                 getDefaultProperties());
>         MutableConfiguration<StringGeneratedCacheKey, String> config
>                 = new MutableConfiguration<>();
>         config.setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(
>                 new Duration(TimeUnit.MINUTES, 10)));
>         cache = cacheManager.createCache("testCache", config);
>
> In the logs I see both caches being created:
>
> Using getCacheManager:
>
> INFO: initialized MemoryCache for testCache
> Sep 14, 2015 1:07:58 PM
> org.apache.commons.jcs.engine.control.CompositeCache
> <init>
> INFO: Constructed cache with name [testCache] and cache attributes [
> useLateral = true, useRemote = true, useDisk = true, maxObjs = 200001,
> maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
> Sep 14, 2015 1:07:58 PM
> org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> parseAuxiliary
> SEVERE: Could not instantiate auxFactory named "DC".
> Sep 14, 2015 1:07:58 PM
> org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
> parseRegions
> INFO: Parsed regions [testCache]
>
> Then the default version:
>
> INFO: initialized MemoryCache for testCache
> Sep 14, 2015 1:07:58 PM
> org.apache.commons.jcs.engine.control.CompositeCache
> <init>
> INFO: Constructed cache with name [testCache] and cache attributes [
> useLateral = true, useRemote = true, useDisk = true, maxObjs = 100,
> maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
>
> The annotations are using athe default configuration.
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/JCache-annotations-using-default-cache-instead-of-MutableConfiguration-or-configuration-file-tp4676198.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>