You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by cl...@apache.org on 2015/05/10 15:04:01 UTC
[32/50] [abbrv] jena git commit: Clean code.
Clean code.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/e81ee641
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/e81ee641
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/e81ee641
Branch: refs/heads/add-contract-tests
Commit: e81ee641d7ee7dbb7e4dbde792d7e79af4a7df72
Parents: fa3bae8
Author: Andy Seaborne <an...@apache.org>
Authored: Thu May 7 10:29:00 2015 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu May 7 10:29:00 2015 +0100
----------------------------------------------------------------------
.../apache/jena/atlas/lib/cache/CacheGuava.java | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/e81ee641/jena-base/src/main/java/org/apache/jena/atlas/lib/cache/CacheGuava.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/cache/CacheGuava.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/cache/CacheGuava.java
index a25faa0..9beffaf 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/cache/CacheGuava.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/lib/cache/CacheGuava.java
@@ -21,31 +21,28 @@ package org.apache.jena.atlas.lib.cache;
import java.util.Iterator ;
import java.util.concurrent.Callable ;
import java.util.concurrent.ExecutionException ;
-import java.util.function.BiConsumer;
+import java.util.function.BiConsumer ;
import org.apache.jena.atlas.lib.Cache ;
import org.apache.jena.atlas.logging.Log ;
import org.apache.jena.ext.com.google.common.cache.CacheBuilder ;
import org.apache.jena.ext.com.google.common.cache.RemovalListener ;
-import org.apache.jena.ext.com.google.common.cache.RemovalNotification ;
-/** Wrapper around com.google.common.cache */
+/** Wrapper around a shaded com.google.common.cache */
final
public class CacheGuava<K,V> implements Cache<K, V>
{
private BiConsumer<K, V> dropHandler = null ;
- /*private*/ org.apache.jena.ext.com.google.common.cache.Cache<K,V> cache ;
+ private org.apache.jena.ext.com.google.common.cache.Cache<K,V> cache ;
public CacheGuava(int size)
{
- RemovalListener<K,V> drop = new RemovalListener<K, V>() {
- @Override
- public void onRemoval(RemovalNotification<K, V> notification) {
- if ( dropHandler != null )
- dropHandler.accept(notification.getKey(),
- notification.getValue()) ;
- }
+ RemovalListener<K,V> drop = (notification)-> {
+ if ( dropHandler != null )
+ dropHandler.accept(notification.getKey(),
+ notification.getValue()) ;
} ;
+
cache = CacheBuilder.newBuilder()
.maximumSize(size)
.removalListener(drop)
@@ -54,7 +51,6 @@ public class CacheGuava<K,V> implements Cache<K, V>
.build() ;
}
- // Change the interface to be ...
@Override
public V getOrFill(K key, Callable<V> filler) {
try {