Wildfly 10 Infinispan TreeCache无效

时间:2017-06-08 20:40:03

标签: wildfly wildfly-10 infinispan infinispan-8 infinispan-9

我从Wildfly 8.2迁移到10.1不幸的是,我遇到了Infinispan TreeCache的问题。

以下是几个问题:

  1. Wildfly 10不再支持调用批处理 构造
  2. 这是我的配置:

    <subsystem xmlns="urn:jboss:domain:infinispan:4.0">
    ...
      <cache-container name="my_container" default-cache="my_tree_cache" jndi-name="java:jboss/my_container">
          <transport lock-timeout="60000"/>
          <local-cache name="my_cache"/> 
          <local-cache name="my_tree_cache" batching="true"/> 
      </cache-container>
    </subsystem>
    

    启动时出错:

    > Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[345,17] 
    > Message: WFLYCTL0197: Unexpected attribute 'batching' encountered
    
    1. 如果我删除&#34;批处理&#34;属性。我收到此错误:
    2. com.daiwacm.modjsf.dataaccess.DataException: getTreeCache has failed for jndi value (my_tree_cache)
      Caused by: org.infinispan.commons.CacheConfigurationException: invocationBatching is not 
      enabled for cache 'my_tree_cache'. Make sure this is enabled by calling configurationBuilder.invocationBatching().enable()
      
      1. 如果我以编程方式设置批处理:
      2. Context context = new InitialContext();
        CacheContainer cacheContainer = (CacheContainer) context.lookup(jndiName);
        TreeCacheFactory tcf = new TreeCacheFactory();
        Cache cache = cacheContainer.getCache(cacheName);
        cache.getCacheManager().defineConfiguration(cacheName, 
             new ConfigurationBuilder().read(cache.getCacheConfiguration()).invocationBatching().enable().build());
        TreeCache treeCache = tcf.createTreeCache(cache);
        

        我收到此错误:

        > Caused by: org.infinispan.commons.CacheConfigurationException:
        > ISPN000381: This configuration is not supported for simple cache
        >         at org.infinispan.configuration.cache.ConfigurationBuilder.validateSimpleCacheConfiguration(ConfigurationBuilder.java:219)
        > ...
        >         at org.infinispan.configuration.cache.InvocationBatchingConfigurationBuilder.build(InvocationBatchingConfigurationBuilder.java:12)
        > ...
        

1 个答案:

答案 0 :(得分:0)

不要以编程方式设置配置;我不确定这是一种有效的方法,尽管它似乎有效。

您正在寻找的配置选项是

<local-cache name="my_cache"> 
    <transaction transaction-mode="BATCH" />
</local-cache>

(如果您有任何疑问,请参阅docs/schema/jboss-as-infinispan_4_0.xsd中的架构)

最后一个问题是,对于本地缓存,WF会在可能的情况下自动启用某些优化。以编程方式重新定义缓存时,将设置此优化(简单缓存)。所以你必须设置

new ConfigurationBuilder().read(cache.getCacheConfiguration())
    .simpleCache(false)
    .invocationBatching().enable()