use of org.infinispan.configuration.cache.TransactionConfiguration in project wildfly by wildfly.
the class CacheConfigurationServiceConfigurator method accept.
@Override
public void accept(ConfigurationBuilder builder) {
TransactionConfiguration tx = this.transaction.get();
builder.memory().read(this.memory.get());
builder.expiration().read(this.expiration.get());
builder.locking().read(this.locking.get());
builder.persistence().read(this.persistence.get());
builder.transaction().read(tx);
builder.statistics().enabled(this.statisticsEnabled);
// See WFLY-14356
if (this.memory.get().storage().canStoreReferences()) {
builder.encoding().mediaType(MediaType.APPLICATION_OBJECT_TYPE);
}
try {
// Configure invocation batching based on transaction configuration
builder.invocationBatching().enable(tx.transactionMode().isTransactional() && (tx.transactionManagerLookup().getTransactionManager() == EmbeddedTransactionManager.getInstance()));
} catch (Exception e) {
throw new CacheException(e);
}
}
use of org.infinispan.configuration.cache.TransactionConfiguration in project hibernate-orm by hibernate.
the class InfinispanRegionFactory method configureTransactionManager.
private void configureTransactionManager(ConfigurationBuilder builder) {
TransactionConfiguration transaction = builder.transaction().create();
if (transaction.transactionMode().isTransactional()) {
final String ispnTmLookupClassName = transaction.transactionManagerLookup().getClass().getName();
final String hbTmLookupClassName = org.hibernate.cache.infinispan.tm.HibernateTransactionManagerLookup.class.getName();
if (GenericTransactionManagerLookup.class.getName().equals(ispnTmLookupClassName)) {
log.debug("Using default Infinispan transaction manager lookup " + "instance (GenericTransactionManagerLookup), overriding it " + "with Hibernate transaction manager lookup");
builder.transaction().transactionManagerLookup(transactionManagerlookup);
} else if (ispnTmLookupClassName != null && !ispnTmLookupClassName.equals(hbTmLookupClassName)) {
log.debug("Infinispan is configured [" + ispnTmLookupClassName + "] with a different transaction manager lookup " + "class than Hibernate [" + hbTmLookupClassName + "]");
} else {
// Infinispan TM lookup class null, so apply Hibernate one directly
builder.transaction().transactionManagerLookup(transactionManagerlookup);
}
builder.transaction().useSynchronization(DEF_USE_SYNCHRONIZATION);
}
}
use of org.infinispan.configuration.cache.TransactionConfiguration in project wildfly by wildfly.
the class LocalCacheBuilder method accept.
@Override
public void accept(ConfigurationBuilder builder) {
super.accept(builder);
builder.clustering().cacheMode(CacheMode.LOCAL);
TransactionConfiguration transaction = this.transaction.getValue();
PersistenceConfiguration persistence = this.persistence.getValue();
// Auto-enable simple cache optimization if cache is non-transactional and non-persistent
builder.simpleCache(!transaction.transactionMode().isTransactional() && !persistence.usingStores());
if (InfinispanLogger.ROOT_LOGGER.isTraceEnabled() && builder.simpleCache()) {
InfinispanLogger.ROOT_LOGGER.tracef("Simple cache optimization for %s = %b", this.address, builder.simpleCache());
}
}
Aggregations