Search code examples
javacachingjbossjboss7.xinfinispan

Infinispan cache settings set in JBoss EAP 7.0 standalone.xml not reflected in application


I added a cache through CLI in JBoss 7:

/subsystem=infinispan/cache-container=sample:add
/subsystem=infinispan/cache-container=sample/replicated-cache=account:add(mode=ASYNC)
/subsystem=infinispan/cache-container=sample/replicated-cache=account/component=transaction:write-attribute(name=mode,value=BATCH)
/subsystem=infinispan/cache-container=sample/replicated-cache=account/component=locking:write-attribute(name=isolation, value=REPEATABLE_READ)

Seen it reflected in standalone.xml's Infinispan subsystem:

<cache-container name="sample">
    <replicated-cache name="account" mode="ASYNC">
        <locking isolation="REPEATABLE_READ"/>
        <transaction mode="BATCH"/>
    </replicated-cache>
</cache-container>

Seen it reflected in JBoss console:

enter image description here

But when used within the application, the cache container is found, but the cache is not. Instead, it is created lazily when cacheManager#getCache is called with different settings set.

enter image description here

Mode set is replicated, but what is found is local. Other settings like transaction are also different. Did I miss something?


Solution

  • It appears caches are only eagerly initialized on depending EJB modules. Libraries backed with CDIs don't trigger cache initialization.