从 Wildfly 10 升级到 Wildfly 14 Infinispan 问题

Upgrade from Wildfly 10 to Wildfly 14 Infinispan issue

我们已从 Widlfly 10 迁移到 Wildfly 14。我们的 Infinispan(7.0) 网络缓存容器配置存在问题。在以前的版本中,可以将模式设置为 ASYNC。这不再可能,文档说明:

Deprecated Since 6.0.0 Deprecated. This attribute will be ignored. All cache modes will be treated as SYNC. To perform asynchronous cache operations, use Infinispan's asynchronous cache API.

https://wildscribe.github.io/WildFly/14.0/subsystem/infinispan/cache-container/distributed-cache/index.html

我们不希望使用现在默认的 SYNC 模式,那么我们如何通过配置独立-ha.xml 使用 Infinispan 的异步缓存 API?

Wildfly 10 配置

    <cache-container name="web" default-cache="dist" module="org.wildfly.clustering.web.infinispan">
        <transport lock-timeout="60000"/>
        <distributed-cache name="dist" mode="ASYNC" l1-lifespan="0" owners="2">
            <locking isolation="REPEATABLE_READ"/>
            <transaction mode="BATCH"/>
            <file-store/>
        </distributed-cache>
        <distributed-cache name="concurrent" mode="SYNC" l1-lifespan="0" owners="2">
            <file-store/>
        </distributed-cache>
</cache-container>

Wildfly 14 配置

            <cache-container name="web" default-cache="dist" module="org.wildfly.clustering.web.infinispan">
            <transport lock-timeout="60000"/>
            <distributed-cache name="dist">
                <locking isolation="REPEATABLE_READ"/>
                <transaction mode="BATCH"/>
                <file-store/>
            </distributed-cache>
        </cache-container>

在 WF 14 中,刷新响应后提交对会话缓存的修改 - 因此从用户的角度来看,所有缓存访问实际上都是异步的。

此外,ASYNC 缓存模式与 Infinispan 的异步缓存不同 API。

异步缓存API仅与同步缓存模式相关。

WildFly 论坛中有人提出了同样的问题。参见 https://developer.jboss.org/thread/279453