openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r429797 - in /incubator/openjpa/trunk/openjpa-kernel/src/main: java/org/apache/openjpa/datacache/ resources/org/apache/openjpa/datacache/
Date Tue, 08 Aug 2006 20:23:36 GMT
Author: skim
Date: Tue Aug  8 13:23:35 2006
New Revision: 429797

URL: http://svn.apache.org/viewvc?rev=429797&view=rev
Log:
Include unpinAll/pinAll by class methods

Modified:
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractDataCache.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/ConcurrentDataCache.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCache.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DelegatingDataCache.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/datacache/localizer.properties

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractDataCache.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractDataCache.java?rev=429797&r1=429796&r2=429797&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractDataCache.java
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractDataCache.java
Tue Aug  8 13:23:35 2006
@@ -224,6 +224,11 @@
         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 @@
         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 @@
             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);
 		}
 	}
 }

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/ConcurrentDataCache.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/ConcurrentDataCache.java?rev=429797&r1=429796&r2=429797&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/ConcurrentDataCache.java
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/ConcurrentDataCache.java
Tue Aug  8 13:23:35 2006
@@ -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 @@
     extends AbstractDataCache
     implements RemoteCommitListener {
 
+    private static final Localizer _loc = Localizer.forPackage
+        (ConcurrentDataCache.class);
+
     private final CacheMap _cache = newCacheMap();
 
     /**
@@ -83,6 +87,12 @@
     public void initialize(DataCacheManager mgr) {
         super.initialize(mgr);
         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() {

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCache.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCache.java?rev=429797&r1=429796&r2=429797&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCache.java
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCache.java
Tue Aug  8 13:23:35 2006
@@ -196,6 +196,12 @@
     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}.
      * This method does not remove anything from the cache; it merely
@@ -214,6 +220,12 @@
      * @see #unpin
      */
     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.

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DelegatingDataCache.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DelegatingDataCache.java?rev=429797&r1=429796&r2=429797&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DelegatingDataCache.java
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DelegatingDataCache.java
Tue Aug  8 13:23:35 2006
@@ -241,6 +241,16 @@
         }
     }
 
+    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;
@@ -256,6 +266,16 @@
             return EMPTY_BITSET;
         try {
             return _cache.unpinAll(oids);
+        } catch (RuntimeException re) {
+            throw translate(re);
+        }
+    }
+
+    public void unpinAll(Class cls, boolean subs) {
+        if (_cache == null)
+            return;
+        try {
+            _cache.unpinAll(cls, subs);
         } catch (RuntimeException re) {
             throw translate(re);
         }

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/datacache/localizer.properties
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/datacache/localizer.properties?rev=429797&r1=429796&r2=429797&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/datacache/localizer.properties
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/datacache/localizer.properties
Tue Aug  8 13:23:35 2006
@@ -27,6 +27,10 @@
 	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 \



Mime
View raw message