diff --git a/build.gradle b/build.gradle index 4aa64791c5..5cb847e863 100644 --- a/build.gradle +++ b/build.gradle @@ -48,8 +48,8 @@ subprojects { group = 'com.github.ben-manes.caffeine' version.with { major = 2 // incompatible API changes - minor = 1 // backwards-compatible additions - patch = 1 // backwards-compatible bug fixes + minor = 2 // backwards-compatible additions + patch = 0 // backwards-compatible bug fixes releaseBuild = rootProject.hasProperty('release') } archivesBaseName = path[1..-1].replaceAll(':', '-').toLowerCase() diff --git a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/CacheType.java b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/CacheType.java index 5c25fb685c..89be0d098d 100644 --- a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/CacheType.java +++ b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/CacheType.java @@ -21,7 +21,6 @@ import org.cache2k.impl.ClockProPlusCache; import org.cache2k.impl.LruCache; import org.cliffc.high_scale_lib.NonBlockingHashMap; -import org.ehcache.config.Eviction.Prioritizer; import org.infinispan.commons.equivalence.AnyEquivalence; import org.infinispan.commons.util.concurrent.jdk8backported.BoundedEquivalentConcurrentHashMapV8; import org.infinispan.commons.util.concurrent.jdk8backported.BoundedEquivalentConcurrentHashMapV8.Eviction; @@ -100,9 +99,9 @@ public enum CacheType { return new Ehcache2<>(MemoryStoreEvictionPolicy.LRU, maximumSize); } }, - Ehcache3_Lru { + Ehcache3 { @Override public BasicCache create(int maximumSize) { - return new Ehcache3<>(Prioritizer.LRU, maximumSize); + return new Ehcache3<>(maximumSize); } }, Guava { diff --git a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/EvictionBenchmark.java b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/EvictionBenchmark.java index ffb091d3aa..444767b62c 100644 --- a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/EvictionBenchmark.java +++ b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/EvictionBenchmark.java @@ -40,7 +40,7 @@ public class EvictionBenchmark { "LinkedHashMap_Lru", "Caffeine", "Ehcache2_Lru", - "Ehcache3_Lru", + "Ehcache3", }) CacheType cacheType; diff --git a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/GetPutBenchmark.java b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/GetPutBenchmark.java index f658a424ba..3d769e2c05 100644 --- a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/GetPutBenchmark.java +++ b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/GetPutBenchmark.java @@ -55,7 +55,7 @@ public class GetPutBenchmark { "Cache2k_ClockProPlus", "Cache2k_Lru", "Ehcache2_Lru", - "Ehcache3_Lru", + "Ehcache3", "Infinispan_Old_Lru", "Infinispan_New_Lru", "TCache_Lfu", diff --git a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/impl/Ehcache3.java b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/impl/Ehcache3.java index 8b53e268b7..089ac00f74 100644 --- a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/impl/Ehcache3.java +++ b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/impl/Ehcache3.java @@ -17,10 +17,9 @@ import org.ehcache.Cache; import org.ehcache.CacheManager; -import org.ehcache.CacheManagerBuilder; -import org.ehcache.config.CacheConfigurationBuilder; -import org.ehcache.config.Eviction.Prioritizer; -import org.ehcache.config.ResourcePoolsBuilder; +import org.ehcache.config.builders.CacheConfigurationBuilder; +import org.ehcache.config.builders.CacheManagerBuilder; +import org.ehcache.config.builders.ResourcePoolsBuilder; import org.ehcache.config.units.EntryUnit; import com.github.benmanes.caffeine.cache.BasicCache; @@ -32,15 +31,14 @@ public final class Ehcache3 implements BasicCache { private final Cache cache; @SuppressWarnings("unchecked") - public Ehcache3(Prioritizer evictionPolicy, int maximumSize) { + public Ehcache3(int maximumSize) { CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder().build(true); cache = (Cache) cacheManager.createCache("benchmark", - CacheConfigurationBuilder.newCacheConfigurationBuilder() + CacheConfigurationBuilder.newCacheConfigurationBuilder(Object.class, Object.class) .withResourcePools(ResourcePoolsBuilder.newResourcePoolsBuilder() .heap(maximumSize, EntryUnit.ENTRIES) .build()) - .usingEvictionPrioritizer(evictionPolicy) - .buildConfig(Object.class, Object.class)); + .build()); } @Override diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java index ee2c83d3bb..127c79fc5c 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java @@ -832,7 +832,7 @@ public LoadingCache build( /** * Builds a cache, which either returns a {@link CompletableFuture} already loaded or currently - * computing the value for a given key or atomically computes the value asynchronously through a + * computing the value for a given key, or atomically computes the value asynchronously through a * supplied mapping function or the supplied {@code CacheLoader}. If the asynchronous computation * fails or computes a {@code null} value then the entry will be automatically removed. Note that * multiple threads can concurrently load values for distinct keys. @@ -855,7 +855,7 @@ public AsyncLoadingCache buildAsync( /** * Builds a cache, which either returns a {@link CompletableFuture} already loaded or currently - * computing the value for a given key or atomically computes the value asynchronously through a + * computing the value for a given key, or atomically computes the value asynchronously through a * supplied mapping function or the supplied {@code AsyncCacheLoader}. If the asynchronous * computation fails or computes a {@code null} value then the entry will be automatically * removed. Note that multiple threads can concurrently load values for distinct keys. @@ -885,11 +885,11 @@ public AsyncLoadingCache buildAsync( : new UnboundedLocalCache.UnboundedLocalAsyncLoadingCache(self, loader); } - private void requireNonLoadingCache() { + void requireNonLoadingCache() { requireState(refreshNanos == UNSET_INT, "refreshAfterWrite requires a LoadingCache"); } - private void requireWeightWithWeigher() { + void requireWeightWithWeigher() { if (weigher == null) { requireState(maximumWeight == UNSET_INT, "maximumWeight requires weigher"); } else if (strictParsing) { diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 4f873f28c0..dfe2c64aa1 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -55,10 +55,10 @@ ext { cache2k: '0.23', concurrentlinkedhashmap: '1.4.2', ehcache2: '2.10.1-55', - ehcache3: '3.0.0.m4', + ehcache3: '3.0.0.m5', high_scale_lib: '1.0.6', infinispan: '8.2.0.Beta2', - jackrabbit: '1.3.15', + jackrabbit: '1.3.16', jamm: '0.3.1', java_object_layout: '0.4', koloboke: '0.6.8', @@ -70,7 +70,7 @@ ext { coveralls: '2.6.3', extra_conf: '3.0.3', error_prone: '0.0.8', - jacoco: '0.7.5.201505241946', + jacoco: '0.7.6.201602180812', jmh: '0.2.0', nexus: '2.3.1', versions: '0.12.0', diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/product/Ehcache3Policy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/product/Ehcache3Policy.java index ccd949c693..23747fea56 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/product/Ehcache3Policy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/product/Ehcache3Policy.java @@ -19,11 +19,9 @@ import org.ehcache.Cache; import org.ehcache.CacheManager; -import org.ehcache.CacheManagerBuilder; -import org.ehcache.config.CacheConfigurationBuilder; -import org.ehcache.config.Eviction.Prioritizer; -import org.ehcache.config.EvictionPrioritizer; -import org.ehcache.config.ResourcePoolsBuilder; +import org.ehcache.config.builders.CacheConfigurationBuilder; +import org.ehcache.config.builders.CacheManagerBuilder; +import org.ehcache.config.builders.ResourcePoolsBuilder; import org.ehcache.config.units.EntryUnit; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; @@ -45,15 +43,14 @@ public final class Ehcache3Policy implements Policy { public Ehcache3Policy(Config config) { policyStats = new PolicyStats("product.Ehcache3"); - Ehcache3Settings settings = new Ehcache3Settings(config); + BasicSettings settings = new BasicSettings(config); CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder().build(true); cache = cacheManager.createCache("ehcache3", - CacheConfigurationBuilder.newCacheConfigurationBuilder() + CacheConfigurationBuilder.newCacheConfigurationBuilder(Object.class, Object.class) .withResourcePools(ResourcePoolsBuilder.newResourcePoolsBuilder() .heap(settings.maximumSize(), EntryUnit.ENTRIES) .build()) - .usingEvictionPrioritizer(settings.prioritizer()) - .buildConfig(Object.class, Object.class)); + .build()); maximumSize = settings.maximumSize(); } @@ -81,13 +78,4 @@ public void record(long key) { public PolicyStats stats() { return policyStats; } - - static final class Ehcache3Settings extends BasicSettings { - public Ehcache3Settings(Config config) { - super(config); - } - public EvictionPrioritizer prioritizer() { - return Prioritizer.valueOf(config().getString("ehcache3.policy").toUpperCase()); - } - } } diff --git a/simulator/src/main/resources/reference.conf b/simulator/src/main/resources/reference.conf index d008a55a30..2f51769bcc 100644 --- a/simulator/src/main/resources/reference.conf +++ b/simulator/src/main/resources/reference.conf @@ -219,11 +219,6 @@ caffeine.simulator { policy = "lru" } - ehcache3 { - # Policies: Lru, Lfu, Fifo - policy = "lru" - } - infinispan { # Policies: Lru, Lirs policy = "lirs"