Search in sources :

Example 1 with TransactionConfiguration

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);
    }
}
Also used : TransactionConfiguration(org.infinispan.configuration.cache.TransactionConfiguration) CacheException(org.infinispan.commons.CacheException) CacheException(org.infinispan.commons.CacheException) OperationFailedException(org.jboss.as.controller.OperationFailedException)

Example 2 with TransactionConfiguration

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);
    }
}
Also used : TransactionConfiguration(org.infinispan.configuration.cache.TransactionConfiguration) GenericTransactionManagerLookup(org.infinispan.transaction.lookup.GenericTransactionManagerLookup)

Example 3 with TransactionConfiguration

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());
    }
}
Also used : PersistenceConfiguration(org.infinispan.configuration.cache.PersistenceConfiguration) TransactionConfiguration(org.infinispan.configuration.cache.TransactionConfiguration)

Aggregations

TransactionConfiguration (org.infinispan.configuration.cache.TransactionConfiguration)3 CacheException (org.infinispan.commons.CacheException)1 PersistenceConfiguration (org.infinispan.configuration.cache.PersistenceConfiguration)1 GenericTransactionManagerLookup (org.infinispan.transaction.lookup.GenericTransactionManagerLookup)1 OperationFailedException (org.jboss.as.controller.OperationFailedException)1