commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From froehl...@apache.org
Subject cvs commit: jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore SynchronizedStore.java Store.java SoftRefMemoryStore.java
Date Mon, 11 Feb 2002 17:29:30 GMT
froehlich    02/02/11 09:29:30

  Modified:    simplestore/src/java/org/apache/commons/simplestore
                        SynchronizedStore.java Store.java
                        SoftRefMemoryStore.java
  Log:
  removed all un-necessary methods. Very
  minimalistic now!
  
  Revision  Changes    Path
  1.8       +6 -16     jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/SynchronizedStore.java
  
  Index: SynchronizedStore.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/SynchronizedStore.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SynchronizedStore.java	10 Feb 2002 11:32:49 -0000	1.7
  +++ SynchronizedStore.java	11 Feb 2002 17:29:30 -0000	1.8
  @@ -59,10 +59,9 @@
    *      baliuka@mwm.lt</a>
    *@author     Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">
    *      g-froehlich@gmx.de</a>
  - *@version    $Id: SynchronizedStore.java,v 1.7 2002/02/10 11:32:49 froehlich Exp $
  + *@version    $Id: SynchronizedStore.java,v 1.8 2002/02/11 17:29:30 froehlich Exp $
    */
  -final class SynchronizedStore
  -         implements Store {
  +final class SynchronizedStore implements Store {
   
       private Store store;
   
  @@ -82,7 +81,7 @@
        * Get the object associated to the given unique key.
        *
        *@param  key  the Key Object
  -     *@return
  +     *@return requested object or null
        */
       public Object get(Object key) {
           synchronized (store) {
  @@ -90,25 +89,16 @@
           }
       }
   
  -   
       /**
  -     * Remove the object associated to the given key.
  +     * Store the object associated to the given unique key.
        *
  -     *@param  key  the Key Object
  -     *@return
  +     *@param  key  the key object
  +     *@param  value  the value Object
        */
  -    public Object remove(Object key) {
  -        synchronized (store) {
  -            return store.remove(key);
  -        }
  -    }
  -
  -
       public void put(Object key, Object value) {
           synchronized (store) {
               store.put(key, value);
           }
       }
  -
   }
   
  
  
  
  1.13      +14 -6     jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/Store.java
  
  Index: Store.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/Store.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Store.java	10 Feb 2002 10:00:12 -0000	1.12
  +++ Store.java	11 Feb 2002 17:29:30 -0000	1.13
  @@ -55,19 +55,27 @@
   package org.apache.commons.simplestore;
   
   /**
  - * Interface for the Store implementations
  + * Minimalistic interface for the cache implementations
    *
    * @author Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">
    *      g-froehlich@gmx.de</a>
  - * @version $Id: Store.java,v 1.12 2002/02/10 10:00:12 baliuka Exp $
  + * @version $Id: Store.java,v 1.13 2002/02/11 17:29:30 froehlich Exp $
    */
   public interface Store {
  -    
  +    /**
  +     * Get the object associated to the given unique key.
  +     *
  +     *@param  key  the Key Object
  +     *@return requested object or null
  +     */
       Object get(Object key);
       
  +    /**
  +     * Store the object associated to the given unique key.
  +     *
  +     *@param  key  the key object
  +     *@param  value  the value Object
  +     */
       void put(Object key, Object value);
  -    
  -    Object remove(Object key);
  -          
   }
   
  
  
  
  1.13      +11 -47    jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/SoftRefMemoryStore.java
  
  Index: SoftRefMemoryStore.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/SoftRefMemoryStore.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SoftRefMemoryStore.java	10 Feb 2002 11:32:49 -0000	1.12
  +++ SoftRefMemoryStore.java	11 Feb 2002 17:29:30 -0000	1.13
  @@ -63,23 +63,23 @@
    *      baliuka@mwm.lt</a>
    *@author     Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">
    *      g-froehlich@gmx.de</a>
  - *@version    $Id: SoftRefMemoryStore.java,v 1.12 2002/02/10 11:32:49 froehlich Exp $
  + *@version    $Id: SoftRefMemoryStore.java,v 1.13 2002/02/11 17:29:30 froehlich Exp $
    */
  -public class SoftRefMemoryStore
  -         implements Store {
  +public class SoftRefMemoryStore implements Store {
   
       private static boolean DEBUG = true;
  -    private int m_maxStrongRefCount;
  -    private Object[] m_strongRefs;
  +    
       private int m_current = 0;
  +    private int m_maxStrongRefCount;
       private Map m_map;
  +    private Object[] m_strongRefs;
       private ReferenceQueue m_queue = new ReferenceQueue();
   
       /**
        * Creates new SoftRefMemoryStore
        *
  -     *@param  map                Description of Parameter
  -     *@param  maxStrongRefCount  Description of Parameter
  +     *@param  map 
  +     *@param  maxStrongRefCount
        */
       protected SoftRefMemoryStore(Map map, int maxStrongRefCount) {
           this.m_map = map;
  @@ -102,7 +102,7 @@
        * Get the object associated to the given unique key.
        *
        *@param  key  the Key Object
  -     *@return      Description of the Returned Value
  +     *@return requested object or null
        */
       public Object get(Object key) {
           removeSoftRef();
  @@ -117,51 +117,15 @@
           return object;
       }
   
  -    public boolean isEmpty() {
  -        return m_map.isEmpty();
  -    }
  -
  -    /**
  -     * Remove the object associated to the given key.
  -     *
  -     *@param  key  the Key Object
  -     *@return      Description of the Returned Value
  -     */
  -    public Object remove(Object key) {
  -        removeSoftRef();
  -        return m_map.remove(key);
  -    }
  -
  -    /**
  -     * Indicates if the given key is associated to a contained object.
  -     *
  -     *@param  key  the Key Object
  -     *@return      Description of the Returned Value
  -     */
  -    public boolean containsKey(Object key) {
  -        removeSoftRef();
  -        return m_map.containsKey(key);
  -    }
  -
       /**
  -     * Store the given object in a persistent state. It is up to the
  -     * caller to ensure that the key has a persistent state across
  -     * different JVM executions.
  +     * Store the object associated to the given unique key.
        *
  -     *@param  key     the Key Object
  -     *@param  object  Description of Parameter
  +     *@param  key  the key object
  +     *@param  value  the value Object
        */
       public void put(Object key, Object object) {
           removeSoftRef();
           internalStoreObject(key, object);
  -    }
  -
  -    public int size() {
  -        return m_map.size();
  -    }
  -
  -    public void clear() {
  -        m_map.clear();
       }
   
       private SoftRef makeValue(Object key, Object value, ReferenceQueue queue) {
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message