HHH-6062 Infinispan now integrates as a synchronization

* A new property has been defined to control whether it hooks as a
synchronization or as an XA resource.
* Updated Infinispan to 5.0.0.CR4.
This commit is contained in:
Galder Zamarreño 2011-06-06 18:44:45 +02:00
parent 9c90c25fea
commit f78c79d676
2 changed files with 21 additions and 1 deletions

View File

@ -5,7 +5,7 @@ configurations {
} }
dependencies { dependencies {
infinispanVersion = '5.0.0.CR2' infinispanVersion = '5.0.0.CR4'
jnpVersion = '5.0.3.GA' jnpVersion = '5.0.3.GA'
compile(project(':hibernate-core')) compile(project(':hibernate-core'))

View File

@ -72,6 +72,16 @@ public class InfinispanRegionFactory implements RegionFactory {
public static final String INFINISPAN_GLOBAL_STATISTICS_PROP = "hibernate.cache.infinispan.statistics"; public static final String INFINISPAN_GLOBAL_STATISTICS_PROP = "hibernate.cache.infinispan.statistics";
/**
* Property that controls whether Infinispan should interact with the
* transaction manager as a {@link javax.transaction.Synchronization} or as
* an XA resource. If the property is set to true, it will be a
* synchronization, otherwise an XA resource.
*
* @see #DEF_USE_SYNCHRONIZATION
*/
public static final String INFINISPAN_USE_SYNCHRONIZATION_PROP = "hibernate.cache.infinispan.use_synchronization";
private static final String ENTITY_KEY = "entity"; private static final String ENTITY_KEY = "entity";
/** /**
@ -131,6 +141,11 @@ public class InfinispanRegionFactory implements RegionFactory {
*/ */
public static final String DEF_QUERY_RESOURCE = "local-query"; public static final String DEF_QUERY_RESOURCE = "local-query";
/**
* Default value for {@link #INFINISPAN_USE_SYNCHRONIZATION_PROP}.
*/
public static final boolean DEF_USE_SYNCHRONIZATION = true;
private EmbeddedCacheManager manager; private EmbeddedCacheManager manager;
private final Map<String, TypeOverrides> typeOverrides = new HashMap<String, TypeOverrides>(); private final Map<String, TypeOverrides> typeOverrides = new HashMap<String, TypeOverrides>();
@ -422,6 +437,11 @@ public class InfinispanRegionFactory implements RegionFactory {
} else { } else {
regionOverrides.setTransactionManagerLookup(transactionManagerlookup); regionOverrides.setTransactionManagerLookup(transactionManagerlookup);
} }
String useSyncProp = ConfigurationHelper.extractPropertyValue(INFINISPAN_USE_SYNCHRONIZATION_PROP, properties);
boolean useSync = useSyncProp == null ? DEF_USE_SYNCHRONIZATION : Boolean.parseBoolean(useSyncProp);
regionOverrides.fluent().transaction().useSynchronization(useSync);
return regionOverrides; return regionOverrides;
} }