You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@omid.apache.org by fp...@apache.org on 2016/05/11 18:06:18 UTC
[11/50] [abbrv] incubator-omid git commit: Remove Cache interface
Remove Cache interface
Change-Id: I5a3ca5e412f3fb7fa6bd679617507b098b9978f9
Project: http://git-wip-us.apache.org/repos/asf/incubator-omid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-omid/commit/cf6beeea
Tree: http://git-wip-us.apache.org/repos/asf/incubator-omid/tree/cf6beeea
Diff: http://git-wip-us.apache.org/repos/asf/incubator-omid/diff/cf6beeea
Branch: refs/heads/master
Commit: cf6beeea499cc2508337dcdb3ee1824c6cbb21be
Parents: 55e6644
Author: Francisco Perez-Sorrosal <fp...@yahoo-inc.com>
Authored: Tue Apr 26 17:16:24 2016 -0700
Committer: Francisco Perez-Sorrosal <fp...@yahoo-inc.com>
Committed: Tue Apr 26 17:16:24 2016 -0700
----------------------------------------------------------------------
.../main/java/org/apache/omid/tso/Cache.java | 30 --------------------
.../org/apache/omid/tso/CacheEvaluation.java | 2 +-
.../java/org/apache/omid/tso/CommitHashMap.java | 2 +-
.../java/org/apache/omid/tso/LongCache.java | 10 +------
.../java/org/apache/omid/tso/TestLongCache.java | 4 +--
5 files changed, 5 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/cf6beeea/tso-server/src/main/java/org/apache/omid/tso/Cache.java
----------------------------------------------------------------------
diff --git a/tso-server/src/main/java/org/apache/omid/tso/Cache.java b/tso-server/src/main/java/org/apache/omid/tso/Cache.java
deleted file mode 100644
index 53abf3d..0000000
--- a/tso-server/src/main/java/org/apache/omid/tso/Cache.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.omid.tso;
-
-/**
- * This interface defines a container for long-long mappings, for instance for holding row -> last commit information
- *
- */
-public interface Cache {
-
- long set(long key, long value);
-
- long get(long key);
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/cf6beeea/tso-server/src/main/java/org/apache/omid/tso/CacheEvaluation.java
----------------------------------------------------------------------
diff --git a/tso-server/src/main/java/org/apache/omid/tso/CacheEvaluation.java b/tso-server/src/main/java/org/apache/omid/tso/CacheEvaluation.java
index a0331fe..68ead7a 100644
--- a/tso-server/src/main/java/org/apache/omid/tso/CacheEvaluation.java
+++ b/tso-server/src/main/java/org/apache/omid/tso/CacheEvaluation.java
@@ -40,7 +40,7 @@ public class CacheEvaluation {
writer.close();
}
- private void testEntriesAge(Cache cache, PrintWriter writer) {
+ private void testEntriesAge(LongCache cache, PrintWriter writer) {
Random random = new Random();
long seed = random.nextLong();
http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/cf6beeea/tso-server/src/main/java/org/apache/omid/tso/CommitHashMap.java
----------------------------------------------------------------------
diff --git a/tso-server/src/main/java/org/apache/omid/tso/CommitHashMap.java b/tso-server/src/main/java/org/apache/omid/tso/CommitHashMap.java
index df7544d..7f1268a 100644
--- a/tso-server/src/main/java/org/apache/omid/tso/CommitHashMap.java
+++ b/tso-server/src/main/java/org/apache/omid/tso/CommitHashMap.java
@@ -40,7 +40,7 @@ class CommitHashMap {
private static final Logger LOG = LoggerFactory.getLogger(CommitHashMap.class);
- private final Cache cellIdToCommitMap;
+ private final LongCache cellIdToCommitMap;
/**
* Constructs a new, empty hashtable with a default size of 1000
http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/cf6beeea/tso-server/src/main/java/org/apache/omid/tso/LongCache.java
----------------------------------------------------------------------
diff --git a/tso-server/src/main/java/org/apache/omid/tso/LongCache.java b/tso-server/src/main/java/org/apache/omid/tso/LongCache.java
index ecd6cd1..f53b4bb 100644
--- a/tso-server/src/main/java/org/apache/omid/tso/LongCache.java
+++ b/tso-server/src/main/java/org/apache/omid/tso/LongCache.java
@@ -17,7 +17,7 @@
*/
package org.apache.omid.tso;
-public class LongCache implements Cache {
+public class LongCache {
private final long[] cache;
private final int size;
@@ -29,10 +29,6 @@ public class LongCache implements Cache {
this.associativity = associativity;
}
- /* (non-Javadoc)
- * @see org.apache.omid.tso.Cache#set(long, long)
- */
- @Override
public long set(long key, long value) {
final int index = index(key);
int oldestIndex = 0;
@@ -54,10 +50,6 @@ public class LongCache implements Cache {
return oldestValue;
}
- /* (non-Javadoc)
- * @see org.apache.omid.tso.Cache#get(long)
- */
- @Override
public long get(long key) {
final int index = index(key);
for (int i = 0; i < associativity; ++i) {
http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/cf6beeea/tso-server/src/test/java/org/apache/omid/tso/TestLongCache.java
----------------------------------------------------------------------
diff --git a/tso-server/src/test/java/org/apache/omid/tso/TestLongCache.java b/tso-server/src/test/java/org/apache/omid/tso/TestLongCache.java
index c02ed85..0c0d02a 100644
--- a/tso-server/src/test/java/org/apache/omid/tso/TestLongCache.java
+++ b/tso-server/src/test/java/org/apache/omid/tso/TestLongCache.java
@@ -42,7 +42,7 @@ public class TestLongCache {
// Cache configuration
final int CACHE_SIZE = 10_000_000;
final int CACHE_ASSOCIATIVITY = 32;
- Cache cache = new LongCache(CACHE_SIZE, CACHE_ASSOCIATIVITY);
+ LongCache cache = new LongCache(CACHE_SIZE, CACHE_ASSOCIATIVITY);
// After creation, cache values should be the default
for (int i = 0; i < 1000; i++) {
@@ -70,7 +70,7 @@ public class TestLongCache {
final int entries = 1000;
- Cache cache = new LongCache(entries, 16);
+ LongCache cache = new LongCache(entries, 16);
int removals = 0;
long totalAge = 0;