Skip to content

Commit 0b57c4e

Browse files
alexsnapssebersole
authored andcommitted
HHH-10124 HHH-8732 Upgraded Ehcache to 2.10.1
1 parent 3147a28 commit 0b57c4e

File tree

7 files changed

+78
-115
lines changed

7 files changed

+78
-115
lines changed

hibernate-ehcache/hibernate-ehcache.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ mavenPom {
1919
def osgiDescription() {
2020
return mavenPom.description
2121
}
22+
23+
test {
24+
forkEvery 1
25+
}

hibernate-ehcache/src/main/java/org/hibernate/cache/ehcache/AbstractEhcacheRegionFactory.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.hibernate.cache.ehcache.internal.regions.EhcacheTimestampsRegion;
2525
import org.hibernate.cache.ehcache.internal.strategy.EhcacheAccessStrategyFactory;
2626
import org.hibernate.cache.ehcache.internal.strategy.EhcacheAccessStrategyFactoryImpl;
27-
import org.hibernate.cache.ehcache.internal.util.HibernateEhcacheUtils;
2827
import org.hibernate.cache.ehcache.management.impl.ProviderMBeanRegistrationHelper;
2928
import org.hibernate.cache.spi.CacheDataDescription;
3029
import org.hibernate.cache.spi.CollectionRegion;
@@ -163,7 +162,6 @@ private Ehcache getCache(String name) throws CacheException {
163162
cache = manager.getEhcache( name );
164163
LOG.debug( "started EHCache region: " + name );
165164
}
166-
HibernateEhcacheUtils.validateEhcache( cache );
167165
return cache;
168166
}
169167
catch (net.sf.ehcache.CacheException e) {

hibernate-ehcache/src/main/java/org/hibernate/cache/ehcache/internal/util/HibernateEhcacheUtils.java

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,15 @@
88

99
import java.net.URL;
1010

11-
import net.sf.ehcache.Ehcache;
1211
import net.sf.ehcache.config.CacheConfiguration;
1312
import net.sf.ehcache.config.Configuration;
1413
import net.sf.ehcache.config.ConfigurationFactory;
1514
import net.sf.ehcache.config.NonstopConfiguration;
16-
import net.sf.ehcache.config.TerracottaConfiguration;
17-
import net.sf.ehcache.config.TerracottaConfiguration.ValueMode;
1815
import net.sf.ehcache.config.TimeoutBehaviorConfiguration.TimeoutBehaviorType;
16+
import org.jboss.logging.Logger;
1917

20-
import org.hibernate.cache.CacheException;
2118
import org.hibernate.cache.ehcache.EhCacheMessageLogger;
2219

23-
import org.jboss.logging.Logger;
24-
2520

2621
/**
2722
* Copy of Ehcache utils into Hibernate code base
@@ -56,16 +51,9 @@ public static Configuration loadAndCorrectConfiguration(URL url) {
5651
if ( config == null ) {
5752
return null;
5853
}
59-
54+
6055
if ( config.getDefaultCacheConfiguration() != null
6156
&& config.getDefaultCacheConfiguration().isTerracottaClustered() ) {
62-
if ( ValueMode.IDENTITY
63-
.equals( config.getDefaultCacheConfiguration().getTerracottaConfiguration().getValueMode() ) ) {
64-
LOG.incompatibleCacheValueMode();
65-
config.getDefaultCacheConfiguration()
66-
.getTerracottaConfiguration()
67-
.setValueMode( ValueMode.SERIALIZATION.name() );
68-
}
6957
setupHibernateTimeoutBehavior(
7058
config.getDefaultCacheConfiguration()
7159
.getTerracottaConfiguration()
@@ -75,10 +63,6 @@ public static Configuration loadAndCorrectConfiguration(URL url) {
7563

7664
for ( CacheConfiguration cacheConfig : config.getCacheConfigurations().values() ) {
7765
if ( cacheConfig.isTerracottaClustered() ) {
78-
if ( ValueMode.IDENTITY.equals( cacheConfig.getTerracottaConfiguration().getValueMode() ) ) {
79-
LOG.incompatibleCacheValueModePerCache( cacheConfig.getName() );
80-
cacheConfig.getTerracottaConfiguration().setValueMode( ValueMode.SERIALIZATION.name() );
81-
}
8266
setupHibernateTimeoutBehavior( cacheConfig.getTerracottaConfiguration().getNonstopConfiguration() );
8367
}
8468
}
@@ -88,32 +72,4 @@ public static Configuration loadAndCorrectConfiguration(URL url) {
8872
private static void setupHibernateTimeoutBehavior(NonstopConfiguration nonstopConfig) {
8973
nonstopConfig.getTimeoutBehavior().setType( TimeoutBehaviorType.EXCEPTION.getTypeName() );
9074
}
91-
92-
/**
93-
* Validates that the supplied Ehcache instance is valid for use as a Hibernate cache.
94-
*
95-
* @param cache The cache instance
96-
*
97-
* @throws CacheException If any explicit settings on the cache are not validate
98-
*/
99-
public static void validateEhcache(Ehcache cache) throws CacheException {
100-
final CacheConfiguration cacheConfig = cache.getCacheConfiguration();
101-
102-
if ( cacheConfig.isTerracottaClustered() ) {
103-
final TerracottaConfiguration tcConfig = cacheConfig.getTerracottaConfiguration();
104-
switch ( tcConfig.getValueMode() ) {
105-
case IDENTITY: {
106-
throw new CacheException(
107-
"The clustered Hibernate cache " + cache.getName() + " is using IDENTITY value mode.\n"
108-
+ "Identity value mode cannot be used with Hibernate cache regions."
109-
);
110-
}
111-
case SERIALIZATION:
112-
default: {
113-
// this is the recommended valueMode
114-
break;
115-
}
116-
}
117-
}
118-
}
11975
}

hibernate-ehcache/src/main/java/org/hibernate/cache/ehcache/management/impl/EhcacheHibernate.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,9 @@ public boolean isHibernateStatisticsSupported() {
8080
@Override
8181
public void setStatisticsEnabled(boolean flag) {
8282
if ( flag ) {
83-
ehcacheStats.enableStats();
8483
hibernateStats.enableStats();
8584
}
8685
else {
87-
ehcacheStats.disableStats();
8886
hibernateStats.disableStats();
8987
}
9088
statsEnabled.set( flag );
@@ -104,7 +102,6 @@ public boolean isStatisticsEnabled() {
104102
*/
105103
@Override
106104
public void clearStats() {
107-
ehcacheStats.clearStats();
108105
hibernateStats.clearStats();
109106
}
110107

0 commit comments

Comments
 (0)