Add isEmpty implementation.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@885269 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -256,6 +256,23 @@ public class CacheLineTable<K, V> implements Serializable {
|
|||||||
nullValue = null;
|
nullValue = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized boolean isEmpty() {
|
||||||
|
if (fileTable != null) {
|
||||||
|
try {
|
||||||
|
return fileTable.keys().next() == null;
|
||||||
|
} catch (IOException e) {
|
||||||
|
Debug.logError(e, module);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (isNullSet) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return memoryTable.isEmpty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized int size() {
|
public synchronized int size() {
|
||||||
if (fileTable != null) {
|
if (fileTable != null) {
|
||||||
return this.keySet().size();
|
return this.keySet().size();
|
||||||
|
|||||||
@@ -213,6 +213,10 @@ public class UtilCache<K, V> implements Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return cacheLineTable.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
/** Puts or loads the passed element into the cache
|
/** Puts or loads the passed element into the cache
|
||||||
* @param key The key for the element, used to reference it in the hastables and LRU linked list
|
* @param key The key for the element, used to reference it in the hastables and LRU linked list
|
||||||
* @param value The value of the element
|
* @param value The value of the element
|
||||||
|
|||||||
Reference in New Issue
Block a user