Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 876 Bytes

README.md

File metadata and controls

27 lines (21 loc) · 876 Bytes

btm-infinispan

Integrates Infinispan with Bitronix.

EmbeddedCacheManager cacheManager = ...;

Configuration conf = new ConfigurationBuilder()
    .read(cacheManager.getDefaultCacheConfiguration())
    .transaction()
        .transactionManagerLookup(new BitronixTransactionManagerLookup())
        .transactionMode(TransactionMode.TRANSACTIONAL)
        .useSynchronization(false)
        .recovery().enable()
    .build();

cacheManager.defineConfiguration("xaCache", conf);
Cache cache = cacheManager.getCache("xaCache");

UserTransaction tx = ...;
tx.begin();
cache.put("test", "test");
tx.rollback();

System.out.println(cache.containsKey("test")); // false