WildFly 10.0.0-final
Infinispan 8.1.0-最终
我正在使用2个节点相同的config standalone-full-ha
/subsystem=infinispan/cache-container=infinispan_cache:add( aliases=["infinispan_cache-alias"], default-cache=default_cache, start=LAZY)
/subsystem=infinispan/cache-container=infinispan_cache/transport=TRANSPORT/:add(lock-timeout=60000, stack=tcp)
/subsystem=infinispan/cache-container=infinispan_cache/replicated-cache=default_cache:add(mode=ASYNC)
我以这种方式获得缓存
@Resource(lookup = "java:jboss/infinispan/cache/infinispan_cache/default_cache")
private org.infinispan.Cache<String, Object> cache;
我使用putForExternalRead,然后另一个节点使用get知道值,另一方面,一切顺利,但是当我使用来自节点的get时,输入值,返回null。
cache.putForExternalRead("hola","Hola prueba");
Object o = cache.get("hola");//This o is null
答案 0 :(得分:0)
解决方案是在批处理SYNC事务下使用TCP堆栈和我自己的缓存正确配置Jgroups
<subsystem xmlns="urn:jboss:domain:infinispan:4.0">
...
<cache-container name="my_infinispan_cache" aliases="my_infinispan_cache-alias" default-cache="default_cache">
<transport lock-timeout="60000"/>
<replicated-cache name="default_cache" mode="SYNC">
<locking isolation="READ_COMMITTED"/>
<transaction locking="OPTIMISTIC" mode="BATCH"/>
<eviction strategy="NONE" max-entries="-1"/>
<expiration lifespan="-1" max-idle="-1"/>
</replicated-cache>
</cache-container>
</subsystem>
...
<subsystem xmlns="urn:jboss:domain:jgroups:4.0">
<channels default="ee">
<channel name="ee" stack="tcp"/>
</channels>
<stacks>
<stack name="udp">
...
</stack>
<stack name="tcp">
<transport type="TCP" socket-binding="jgroups-tcp"/>
<protocol type="MPING" socket-binding="jgroups-mping"/>
<protocol type="MERGE3"/>
<protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/>
<protocol type="FD"/>
<protocol type="VERIFY_SUSPECT"/>
<protocol type="pbcast.NAKACK2"/>
<protocol type="UNICAST3"/>
<protocol type="pbcast.STABLE"/>
<protocol type="pbcast.GMS"/>
<protocol type="MFC"/>
<protocol type="FRAG2"/>
</stack>
</stacks>
</subsystem>