Ehcache无法在XA模式(NotSerializableException)中将数据溢出到磁盘

| 我正在尝试使用Ehcache进行XA事务。目前,我正在使用Spring事务管理和Bitronix作为事务管理器。 我使用以下方法创建,配置和填充缓存:
@Transactional
public void createCache() {
    this.cacheConfiguration = new CacheConfiguration(\"MyCache\", 5000).diskPersistent(false).eternal(false)
            .diskExpiryThreadIntervalSeconds(1).maxElementsInMemory(70).transactionalMode(TransactionalMode.XA);
    final Configuration config = new Configuration();
    config.setDefaultCacheConfiguration(this.cacheConfiguration);
    final DiskStoreConfiguration diskStoreConfiguration = new DiskStoreConfiguration();
    diskStoreConfiguration.setPath(\"cache\");
    config.addDiskStore(diskStoreConfiguration);
    this.cacheManager = new CacheManager(config);
    this.cacheConfiguration.name(\"primaryCache\");
    this.cache = new Cache(this.cacheConfiguration);
    this.cacheManager.addCache(this.cache);

    for (int i = 0; i < 100; i++) {
        final Integer value = Integer.valueOf(i);
        this.cache.put(new Element(value, value));
    }
}
一切正常,Ehcache的运行正常,超过了70个被逐出的元素。 现在,如果将ѭ1从ѭ2更改为
true
,则Ehcache尝试将某些元素复制到磁盘存储后,它将立即不起作用,但以下情况除外:
[primaryCache.data] ERROR n.s.e.s.c.f.DiskStorageFactory btm-gtrid=737072696E672D62746D0000012F9296448C00000000 - Disk Write of 0 failed (it will be evicted instead): 
java.io.NotSerializableException: net.sf.ehcache.transaction.ReadCommittedSoftLockImpl
这是预期的,因为将Ehcache切换为事务模式使它用ѭ6代替ѭ5的原始值:
[main] DEBUG n.s.e.t.local.LocalTransactionStore ehcache-txid=0, btm-gtrid=737072696E672D62746D0000012F9296448C00000000 - put: cache [primaryCache] key [0] was not in, soft lock inserted
完整地说,这在使用Atomikos事务管理器时也会发生,并且在不使用XA模式时也可以完美地工作。 问题是:有没有办法混合XA事务和磁盘溢出?     
已邀请:
一切都应该按您期望的方式工作,但是您刚刚发现了一个错误,该错误完全阻止了开源磁盘持久性存储以任何事务模式工作。 请在Ehcache JIRA(https://jira.terracotta.org/jira/browse/EHC)中报告该问题,我们将尽快解决。     

要回复问题请先登录注册