You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2015/05/09 22:13:25 UTC
jena git commit: Fix counting of current size.
Repository: jena
Updated Branches:
refs/heads/master f64c70233 -> e5035f4bf
Fix counting of current size.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/e5035f4b
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/e5035f4b
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/e5035f4b
Branch: refs/heads/master
Commit: e5035f4bfca48e84b12d49b03680a82f63aca591
Parents: f64c702
Author: Andy Seaborne <an...@apache.org>
Authored: Sat May 9 21:12:50 2015 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Sat May 9 21:12:50 2015 +0100
----------------------------------------------------------------------
.../org/apache/jena/atlas/lib/cache/CacheSimple.java | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/e5035f4b/jena-base/src/main/java/org/apache/jena/atlas/lib/cache/CacheSimple.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/cache/CacheSimple.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/cache/CacheSimple.java
index 9f889dd..ddd81f6 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/cache/CacheSimple.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/lib/cache/CacheSimple.java
@@ -115,16 +115,18 @@ public class CacheSimple<K,V> implements Cache<K,V>
old = values[x] ;
if ( dropHandler != null )
dropHandler.accept(keys[x], old) ;
- currentSize-- ;
+ if ( old != null )
+ currentSize-- ;
}
+ // Already decremented if we are overwriting a full slot.
values[x] = thing ;
- if ( thing == null )
+ if ( thing == null ) {
//put(,null) is a remove.
keys[x] = null ;
- else {
- keys[x] = key ;
+ } else {
currentSize++ ;
+ keys[x] = key ;
}
}
@@ -138,6 +140,11 @@ public class CacheSimple<K,V> implements Cache<K,V>
public long size()
{
return currentSize ;
+// long x = 0 ;
+// for ( K key : keys )
+// if ( key != null )
+// x++ ;
+// return x ;
}
@Override