mirror of
https://github.com/apache/openjpa.git
synced 2025-02-20 17:05:15 +00:00
Include unpinAll/pinAll by class methods
git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@429797 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6234f8d3da
commit
a120874a44
@ -224,6 +224,11 @@ public abstract class AbstractDataCache
|
||||
return set;
|
||||
}
|
||||
|
||||
public void pinAll(Class cls, boolean subs) {
|
||||
if (log.isWarnEnabled())
|
||||
log.warn(s_loc.get("cache-class-pin", getName()));
|
||||
}
|
||||
|
||||
public boolean unpin(Object key) {
|
||||
boolean bool = unpinInternal(key);
|
||||
if (log.isTraceEnabled()) {
|
||||
@ -247,6 +252,11 @@ public abstract class AbstractDataCache
|
||||
return set;
|
||||
}
|
||||
|
||||
public void unpinAll(Class cls, boolean subs) {
|
||||
if (log.isWarnEnabled())
|
||||
log.warn(s_loc.get("cache-class-unpin", getName()));
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
clearInternal();
|
||||
if (log.isTraceEnabled())
|
||||
@ -423,7 +433,7 @@ public abstract class AbstractDataCache
|
||||
listen.onExpire(ev);
|
||||
} catch (Exception e) {
|
||||
if (log.isWarnEnabled())
|
||||
log.warn(s_loc.get ("exp-listener-ex"), e);
|
||||
log.warn(s_loc.get("exp-listener-ex"), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
package org.apache.openjpa.datacache;
|
||||
|
||||
import org.apache.openjpa.event.RemoteCommitListener;
|
||||
import org.apache.openjpa.lib.util.Localizer;
|
||||
import org.apache.openjpa.util.CacheMap;
|
||||
|
||||
/**
|
||||
@ -31,6 +32,9 @@ public class ConcurrentDataCache
|
||||
extends AbstractDataCache
|
||||
implements RemoteCommitListener {
|
||||
|
||||
private static final Localizer _loc = Localizer.forPackage
|
||||
(ConcurrentDataCache.class);
|
||||
|
||||
private final CacheMap _cache = newCacheMap();
|
||||
|
||||
/**
|
||||
@ -85,6 +89,12 @@ public class ConcurrentDataCache
|
||||
conf.getRemoteCommitEventManager().addListener(this);
|
||||
}
|
||||
|
||||
public void unpinAll(Class cls, boolean subs) {
|
||||
if (log.isWarnEnabled())
|
||||
log.warn(_loc.get("cache-class-unpin-all", getName()));
|
||||
unpinAll(_cache.getPinnedKeys());
|
||||
}
|
||||
|
||||
public void writeLock() {
|
||||
_cache.writeLock();
|
||||
}
|
||||
|
@ -195,6 +195,12 @@ public interface DataCache
|
||||
*/
|
||||
public BitSet pinAll(Collection oids);
|
||||
|
||||
/**
|
||||
* Pin all oids for the given type.
|
||||
* @param subs Whether to include subclasses.
|
||||
*/
|
||||
public void pinAll(Class cls, boolean subs);
|
||||
|
||||
/**
|
||||
* Unpin the value stored under <code>oid</code> from the cache.
|
||||
* This method reverses a previous invocation of {@link #pin}.
|
||||
@ -215,6 +221,12 @@ public interface DataCache
|
||||
*/
|
||||
public BitSet unpinAll(Collection oids);
|
||||
|
||||
/**
|
||||
* Unpin all oids associaed with the given type from the cache.
|
||||
* @param subs Whether to include subclasses.
|
||||
*/
|
||||
public void unpinAll(Class cls, boolean subs);
|
||||
|
||||
/**
|
||||
* Obtain a write lock on the cache.
|
||||
*/
|
||||
|
@ -241,6 +241,16 @@ public class DelegatingDataCache
|
||||
}
|
||||
}
|
||||
|
||||
public void pinAll(Class cls, boolean subs) {
|
||||
if (_cache == null)
|
||||
return;
|
||||
try {
|
||||
_cache.pinAll(cls, subs);
|
||||
} catch (RuntimeException re) {
|
||||
throw translate(re);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean unpin(Object oid) {
|
||||
if (_cache == null)
|
||||
return false;
|
||||
@ -261,6 +271,16 @@ public class DelegatingDataCache
|
||||
}
|
||||
}
|
||||
|
||||
public void unpinAll(Class cls, boolean subs) {
|
||||
if (_cache == null)
|
||||
return;
|
||||
try {
|
||||
_cache.unpinAll(cls, subs);
|
||||
} catch (RuntimeException re) {
|
||||
throw translate(re);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeLock() {
|
||||
if (_cache == null)
|
||||
return;
|
||||
|
@ -27,6 +27,10 @@ cache-commit: Performing a commit on the cache. Adding {0}, \
|
||||
updating {1} and {2}, and removing {3}.
|
||||
cache-stats: Usage statistics for cache {0}: hits: {1}; misses: {2}; hit \
|
||||
ratio: {3}
|
||||
cache-class-pin: The cache "{0}" does not support per-class pinning.
|
||||
cache-class-unpin: The cache "{0}" does not support per-class pinning.
|
||||
cache-class-unpin-all: The cache "{0}" does not supper per-class pinning. \
|
||||
All pinned keys will be un-pinned.
|
||||
list-closed: This operation cannot be performed on this list, as the list has \
|
||||
been closed.
|
||||
query-cache-miss-evict: Query cache miss while looking up key "{0}". The \
|
||||
|
Loading…
x
Reference in New Issue
Block a user