简体   繁体   English

在 JBoss EAP 7.0 standalone.xml 中设置的 Infinispan 缓存设置未反映在应用程序中

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

I added a cache through CLI in JBoss 7:我在 JBoss 7 中通过 CLI 添加了一个缓存:

/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:看到它反映在 standalone.xml 的 Infinispan 子系统中:

<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:看到它反映在 JBoss 控制台中:

在此处输入图片说明

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.相反,当使用不同的设置集调用cacheManager#getCache时,它会延迟创建。

在此处输入图片说明

Mode set is replicated, but what is found is local.模式集被复制,但找到的是本地的。 Other settings like transaction are also different.交易等其他设置也不同。 Did I miss something?我错过了什么?

I had very similar problem to you. 我和你有非常相似的问题。 I had a local-cache with configured lifespan in EAP 7. It was configured to be relatively short. 我在EAP 7中有一个配置了生命周期的本地缓存。它配置得相对较短。 The same configuration worked well earlier, but we realized, that the cached stuff remained in the cache forever. 相同的配置在早期就很好用,但是我们意识到,缓存的内容将永远保留在缓存中。

The problem was how we got to the instance of the cache. 问题在于我们如何到达缓存实例。 We injected the cache manager: 我们注入了缓存管理器:

@Resource(lookup = "java:jboss/infinispan/download-manager")
private CacheContainer cacheContainer;

Then we used the cache container to access the cache. 然后,我们使用缓存容器访问缓存。 After debugging the lifespan was -1 even though the lifespan in EAP 7 was 30 seconds only. 调试后,即使EAP 7中的寿命仅为30秒,寿命也为-1。

cacheContainer.getCache("someCache")

Did not get the instance of the cache, but instead of that it created a new cache with default values. 没有获取高速缓存的实例,而是使用默认值创建了一个新的高速缓存。 I think it explains your "local cache" only setting. 我认为这解释了您的“本地缓存”唯一设置。

The way how I got to the cache with the proper settings was: 我如何使用正确的设置进入缓存:

@Resource(lookup = "java:jboss/infinispan/cache/download-manager/someCache")
private Cache<String, Object> negative_cache_direct;

It appears caches are only eagerly initialized on depending EJB modules.看起来缓存只是在依赖的 EJB 模块上急切地初始化。 Libraries backed with CDIs don't trigger cache initialization.由 CDI 支持的库不会触发缓存初始化。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用standalone.xml在JBoss 7.0中分离应用程序日志 - How to separate application Logs in JBoss 7.0 using standalone.xml 如何配置从jboss eap standalone.xml连接到IBM Websphere MQ多实例队列管理器 - How to configure to connect to IBM Websphere MQ Multi Instance Queue Manager from jboss eap standalone.xml 部署后,JBoss EAP 6.4.0无法找到standalone.xml中提供的(远程)主机名 - Upon deployment JBoss EAP 6.4.0 cannot find (remote) host names provided in standalone.xml 编辑standalone.xml后出现错误Jboss - ERROR Jboss after edit of standalone.xml 从standalone.xml到MQ的JBoss连接 - JBoss connection to MQ from standalone.xml 与在代码中手动创建数据源相比,为什么在Jboss EAP 6.4中的standalone.xml中创建数据源具有更长的响应时间 - Why creating datasource in standalone.xml in Jboss EAP 6.4 is giving longer response time as compared to when datasource is created in code manually 将应用程序重定向到JBoss EAP 7.0的默认页面 - Application redirectling to default page of JBoss EAP 7.0 在wildfly 14 standalone.xml中而不是standalone-ha.xml中配置Infinispan - Configure Infinispan in wildfly 14 standalone.xml instead of standalone-ha.xml Jboss 7,如何在standalone.xml中添加自定义日志级别 - Jboss 7 , How to add a custom log level in standalone.xml 在standalone.xml(JBOSS)中配置特定的SFSB状态超时 - Configure specific SFSB stateful-timeout in standalone.xml (JBOSS)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM