我创建了一个在复制模式下运行Infinispan缓存的双节点集群。我看到缓存很好。两个节点相互连接。我在这里使用TreeCache Api将基于Map的结构转换为树,如下所示:
private static Cache<Object, Object> Cache1;
private static TreeCache<Object, Object> Cache;
Cache1 = new DefaultCacheManager("infinispan.xml").getCache();
Cache = new TreeCacheFactory().createTreeCache(Cache1);
如果我调用Cache.put,我不会收到任何错误,但该条目不会保存到缓存中。我通过再次获取返回NULL的数据来确认它。
Cache.put(fqn,key, value);
if(Cache.get(fqn, key) == null)
{
System.out.println("Entry is not saved");
}
以下是配置文件
<?xml version="1.0" encoding="UTF-8"?>
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:5.3 http://www.infinispan.org/schemas/infinispan-config-5.3.xsd"
xmlns="urn:infinispan:config:5.3">
<global>
<globalJmxStatistics enabled = "true" allowDuplicateDomains = "true"/>
<transport clusterName = "test_cluster">
<properties>
<property name="configurationFile" value="tcp.xml" />
</properties>
</transport>
</global>
<default>
<clustering mode="replication">
<async asyncMarshalling="true" useReplQueue="true" replQueueInterval="10" replQueueMaxElements="100" />
<stateTransfer timeout="2000000"/>
</clustering>
<invocationBatching enabled = "true"/>
<locking isolationLevel = "REPEATABLE_READ"
writeSkewCheck = "false"
concurrencyLevel = "1000"/>
<jmxStatistics enabled="true"/>
</default>
</infinispan>
我是否缺少初始化任何东西?