From 59e30e908f4eb4b3dccea0dad15fdcc93e17984a Mon Sep 17 00:00:00 2001 From: Ben Manes Date: Sun, 28 Jun 2020 16:48:40 -0700 Subject: [PATCH] Remove Coherence policy due to causing odd build failures --- build.gradle | 1 - gradle/dependencies.gradle | 14 ---- simulator/build.gradle | 2 - .../cache/simulator/policy/Registry.java | 2 - .../policy/product/CoherencePolicy.java | 81 ------------------- 5 files changed, 100 deletions(-) delete mode 100644 simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/product/CoherencePolicy.java diff --git a/build.gradle b/build.gradle index f6283ef1d8..800de2197c 100644 --- a/build.gradle +++ b/build.gradle @@ -156,6 +156,5 @@ tasks.coveralls { } dependencyUpdates.resolutionStrategy { - force libraries.coherenceProvidedScope force testLibraries.truth } diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 1baa1790eb..3e4ab3e5e9 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -99,20 +99,6 @@ ext { akka: "com.typesafe.akka:akka-actor_2.12:${versions.akka}", cache2k: "org.cache2k:cache2k-core:${versions.cache2k}", checkerAnnotations: "org.checkerframework:checker-qual:${versions.checkerFramework}", - coherence: [ - "com.oracle.coherence.ce:coherence:${versions.coherence}", - 'javax.json.bind:javax.json.bind-api:1.0', - ], - coherenceProvidedScope: [ - 'org.glassfish.jersey.core:jersey-server:2.31', - 'javax.json.bind:javax.json.bind-api:1.0', - 'javax.ws.rs:javax.ws.rs-api:2.0', - 'javax.jms:javax.jms-api:2.0.1', - 'javax.inject:javax.inject:1', - 'org.ow2.asm:asm-commons:8.0.1', - 'com.sleepycat:je:18.3.12', - 'org.ow2.asm:asm:8.0.1', - ], collision: "systems.comodal:collision:${versions.collision}", commonsCompress: "org.apache.commons:commons-compress:${versions.commonsCompress}", commonsLang3: "org.apache.commons:commons-lang3:${versions.commonsLang3}", diff --git a/simulator/build.gradle b/simulator/build.gradle index 4cf5671106..77bda17dc6 100644 --- a/simulator/build.gradle +++ b/simulator/build.gradle @@ -20,7 +20,6 @@ dependencies { implementation libraries.ehcache3 implementation libraries.fastutil implementation libraries.slf4jNop - implementation libraries.coherence implementation libraries.collision implementation libraries.fastfilter implementation libraries.flipTables @@ -30,7 +29,6 @@ dependencies { implementation libraries.elasticSearch implementation libraries.commonsCompress implementation libraries.univocityParsers - implementation libraries.coherenceProvidedScope testImplementation testLibraries.testng } diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/Registry.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/Registry.java index c495f5d8dc..c1b8c9aa53 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/Registry.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/Registry.java @@ -45,7 +45,6 @@ import com.github.benmanes.caffeine.cache.simulator.policy.opt.UnboundedPolicy; import com.github.benmanes.caffeine.cache.simulator.policy.product.Cache2kPolicy; import com.github.benmanes.caffeine.cache.simulator.policy.product.CaffeinePolicy; -import com.github.benmanes.caffeine.cache.simulator.policy.product.CoherencePolicy; import com.github.benmanes.caffeine.cache.simulator.policy.product.CollisionPolicy; import com.github.benmanes.caffeine.cache.simulator.policy.product.Ehcache3Policy; import com.github.benmanes.caffeine.cache.simulator.policy.product.ElasticSearchPolicy; @@ -189,7 +188,6 @@ private void registerProduct() { factories.put("product.Tcache", TCachePolicy::policies); factories.put("product.Cache2k", Cache2kPolicy::policies); factories.put("product.Ehcache3", Ehcache3Policy::policies); - factories.put("product.Coherence", CoherencePolicy::policies); factories.put("product.Collision", CollisionPolicy::policies); factories.put("product.ExpiringMap", ExpiringMapPolicy::policies); factories.put("product.Elasticsearch", ElasticSearchPolicy::policies); diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/product/CoherencePolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/product/CoherencePolicy.java deleted file mode 100644 index 2a523f3973..0000000000 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/product/CoherencePolicy.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2020 Ben Manes. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.github.benmanes.caffeine.cache.simulator.policy.product; - -import static com.google.common.base.Preconditions.checkState; - -import java.util.Set; - -import com.github.benmanes.caffeine.cache.simulator.BasicSettings; -import com.github.benmanes.caffeine.cache.simulator.policy.Policy; -import com.github.benmanes.caffeine.cache.simulator.policy.Policy.KeyOnlyPolicy; -import com.github.benmanes.caffeine.cache.simulator.policy.PolicyStats; -import com.google.common.collect.ImmutableSet; -import com.tangosol.net.cache.LocalCache; -import com.tangosol.util.MapEvent; -import com.tangosol.util.MapListener; -import com.typesafe.config.Config; - -/** - * Coherence cache implementation. - * - * @author ben.manes@gmail.com (Ben Manes) - */ -@SuppressWarnings("deprecation") -public final class CoherencePolicy implements KeyOnlyPolicy { - private final PolicyStats policyStats; - private final LocalCache cache; - - public CoherencePolicy(Config config) { - policyStats = new PolicyStats("product.Coherence"); - BasicSettings settings = new BasicSettings(config); - cache = new LocalCache(settings.maximumSize()); - cache.addMapListener(new MapListener() { - @Override public void entryInserted(MapEvent event) {} - @Override public void entryUpdated(MapEvent event) {} - @Override public void entryDeleted(MapEvent event) { - policyStats.recordEviction(); - } - }); - } - - /** Returns all variations of this policy based on the configuration parameters. */ - public static Set policies(Config config) { - return ImmutableSet.of(new CoherencePolicy(config)); - } - - @Override - public void record(long key) { - Object value = cache.get(key); - if (value == null) { - cache.put(key, key); - policyStats.recordMiss(); - } else { - policyStats.recordHit(); - } - } - - @Override - public void finished() { - checkState(policyStats.hitCount() == cache.getCacheHits()); - checkState(policyStats.missCount() == cache.getCacheMisses()); - } - - @Override - public PolicyStats stats() { - return policyStats; - } -}