You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2010/05/14 11:47:14 UTC

svn commit: r944179 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java

Author: lektran
Date: Fri May 14 09:47:14 2010
New Revision: 944179

URL: http://svn.apache.org/viewvc?rev=944179&view=rev
Log:
The following deprecated methods have been removed from org.ofbiz.base.util.cache.UtilCache:
setMaxSize(int)
- Use setMaxInMemory(int) instead
getMaxSize()
- Use getMaxInMemory() instead
hasExpired(Object)
clearExpired()
clearExpiredFromAllCaches()

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java?rev=944179&r1=944178&r2=944179&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java Fri May 14 09:47:14 2010
@@ -659,23 +659,6 @@ public class UtilCache<K, V> implements 
         this.removeMissCount.set(0);
     }
 
-    /** Sets the maximum number of elements in the cache.
-     * If 0, there is no maximum.
-     * @param maxSize The maximum number of elements in the cache
-     * @deprecated Use setMaxInMemory
-     */
-    public void setMaxSize(int maxSize) {
-        setMaxInMemory(maxSize);
-    }
-
-    /** Returns the current maximum number of elements in the cache
-     * @return The maximum number of elements in the cache
-     * @deprecated Use getMaxInMemory
-     */
-    public int getMaxSize() {
-        return getMaxInMemory();
-    }
-
     public void setMaxInMemory(int newInMemory) {
         this.maxInMemory = newInMemory;
         Map<Object, CacheLine<V>> oldmap = this.memoryTable;
@@ -873,28 +856,6 @@ public class UtilCache<K, V> implements 
         return lineInfos;
     }
 
-    /** Returns a boolean specifying whether or not the element corresponding to the key has expired.
-     * Only returns true if element is in cache and has expired. Error conditions return false, if no expireTable entry, returns true.
-     * Always returns false if expireTime <= 0.
-     * Also, if SoftReference in the CacheLine object has been cleared by the gc return true.
-     *
-     * @param key The key for the element, used to reference it in the hastables and LRU linked list
-     * @return True is the element corresponding to the specified key has expired, otherwise false
-     * @deprecated elements are automatically expired in the background
-     */
-    @Deprecated
-    public boolean hasExpired(Object key) {
-        return !memoryTable.containsKey(fromKey(key));
-    }
-
-    /** Clears all expired cache entries; also clear any cache entries where the SoftReference in the CacheLine object has been cleared by the gc
-     * @deprecated entries are removed automatically now
-    */
-    @Deprecated
-    public void clearExpired() {
-        // do nothing, expired values are removed automatically in the background
-    }
-
     /** Send a key addition event to all registered listeners */
     protected void noteAddition(K key, V newValue) {
         for (CacheListener<K, V> listener: listeners) {
@@ -926,14 +887,6 @@ public class UtilCache<K, V> implements 
         listeners.remove(listener);
     }
 
-    /** Clears all expired cache entries from all caches
-     * @deprecated entries are removed automatically now
-    */
-    @Deprecated
-    public static void clearExpiredFromAllCaches() {
-        // do nothing, expired values are removed automatically in the background
-    }
-
     /** Checks for a non-expired key in a specific cache */
     public static boolean validKey(String cacheName, Object key) {
         UtilCache<?, ?> cache = findCache(cacheName);



Re: svn commit: r944179 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java

Posted by Adam Heath <do...@brainfood.com>.
Scott Gray wrote:
> On 27/05/2010, at 1:57 AM, Adam Heath wrote:
> 
>> Scott Gray wrote:
>>> On 26/05/2010, at 3:27 PM, Adam Heath wrote:
>>>
>>>> lektran@apache.org wrote:
>>>>> Author: lektran
>>>>> Date: Fri May 14 09:47:14 2010
>>>>> New Revision: 944179
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=944179&view=rev
>>>>> Log:
>>>>> The following deprecated methods have been removed from org.ofbiz.base.util.cache.UtilCache:
>>>>> setMaxSize(int)
>>>>> - Use setMaxInMemory(int) instead
>>>>> getMaxSize()
>>>>> - Use getMaxInMemory() instead
>>>>> hasExpired(Object)
>>>>> clearExpired()
>>>>> clearExpiredFromAllCaches()
>>>> I would like this commit to be reverted, and applied later.  It's too
>>>> soon to remove the deprecated methods.  It makes it harder to maintain
>>>> external code.  I'd like to see this reapplied when the next release
>>>> branch is made.
>>>>
>>> Feel free to revert it, I don't feel like having a discussion about policy and what's previously been agreed upon right now.
>> I don't feel all that strongly about it.  Reverting code is something
>> that should be done with great care.  I just thing that removing
>> deprecated code should be done later, rather than sooner.  These
>> methods were only deprecated recently.  There hasn't been been an
>> actual real release with this change(just a release branch, which
>> isn't the same thing).
> 
> I really don't mind either (despite my mildly grumpy response last night), this commit was really just a continuation of my efforts to remove deprecated code with my only rule of thumb being that it was deprecated prior to the last release branch.
> 
> If it makes your life easier then by all means revert it.  Whenever I get around to working on this sort of thing again I'll focus on code that was deprecated prior to 9.04 and we can have the discussion about how to proceed once that is all gone.

to be fair, I don't have anything that depends on this.  The code in
question was just one of the multitudinous code changes I've done to
optimize trunk.


Re: svn commit: r944179 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java

Posted by Scott Gray <sc...@hotwaxmedia.com>.
On 27/05/2010, at 1:57 AM, Adam Heath wrote:

> Scott Gray wrote:
>> On 26/05/2010, at 3:27 PM, Adam Heath wrote:
>> 
>>> lektran@apache.org wrote:
>>>> Author: lektran
>>>> Date: Fri May 14 09:47:14 2010
>>>> New Revision: 944179
>>>> 
>>>> URL: http://svn.apache.org/viewvc?rev=944179&view=rev
>>>> Log:
>>>> The following deprecated methods have been removed from org.ofbiz.base.util.cache.UtilCache:
>>>> setMaxSize(int)
>>>> - Use setMaxInMemory(int) instead
>>>> getMaxSize()
>>>> - Use getMaxInMemory() instead
>>>> hasExpired(Object)
>>>> clearExpired()
>>>> clearExpiredFromAllCaches()
>>> I would like this commit to be reverted, and applied later.  It's too
>>> soon to remove the deprecated methods.  It makes it harder to maintain
>>> external code.  I'd like to see this reapplied when the next release
>>> branch is made.
>>> 
>> 
>> Feel free to revert it, I don't feel like having a discussion about policy and what's previously been agreed upon right now.
> 
> I don't feel all that strongly about it.  Reverting code is something
> that should be done with great care.  I just thing that removing
> deprecated code should be done later, rather than sooner.  These
> methods were only deprecated recently.  There hasn't been been an
> actual real release with this change(just a release branch, which
> isn't the same thing).

I really don't mind either (despite my mildly grumpy response last night), this commit was really just a continuation of my efforts to remove deprecated code with my only rule of thumb being that it was deprecated prior to the last release branch.

If it makes your life easier then by all means revert it.  Whenever I get around to working on this sort of thing again I'll focus on code that was deprecated prior to 9.04 and we can have the discussion about how to proceed once that is all gone.

Regards
Scott

Re: svn commit: r944179 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java

Posted by Adam Heath <do...@brainfood.com>.
Scott Gray wrote:
> HotWax Media
> http://www.hotwaxmedia.com
> 
> On 26/05/2010, at 3:27 PM, Adam Heath wrote:
> 
>> lektran@apache.org wrote:
>>> Author: lektran
>>> Date: Fri May 14 09:47:14 2010
>>> New Revision: 944179
>>>
>>> URL: http://svn.apache.org/viewvc?rev=944179&view=rev
>>> Log:
>>> The following deprecated methods have been removed from org.ofbiz.base.util.cache.UtilCache:
>>> setMaxSize(int)
>>> - Use setMaxInMemory(int) instead
>>> getMaxSize()
>>> - Use getMaxInMemory() instead
>>> hasExpired(Object)
>>> clearExpired()
>>> clearExpiredFromAllCaches()
>> I would like this commit to be reverted, and applied later.  It's too
>> soon to remove the deprecated methods.  It makes it harder to maintain
>> external code.  I'd like to see this reapplied when the next release
>> branch is made.
>>
> 
> Feel free to revert it, I don't feel like having a discussion about policy and what's previously been agreed upon right now.

I don't feel all that strongly about it.  Reverting code is something
that should be done with great care.  I just thing that removing
deprecated code should be done later, rather than sooner.  These
methods were only deprecated recently.  There hasn't been been an
actual real release with this change(just a release branch, which
isn't the same thing).


Re: svn commit: r944179 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java

Posted by Scott Gray <sc...@hotwaxmedia.com>.
HotWax Media
http://www.hotwaxmedia.com

On 26/05/2010, at 3:27 PM, Adam Heath wrote:

> lektran@apache.org wrote:
>> Author: lektran
>> Date: Fri May 14 09:47:14 2010
>> New Revision: 944179
>> 
>> URL: http://svn.apache.org/viewvc?rev=944179&view=rev
>> Log:
>> The following deprecated methods have been removed from org.ofbiz.base.util.cache.UtilCache:
>> setMaxSize(int)
>> - Use setMaxInMemory(int) instead
>> getMaxSize()
>> - Use getMaxInMemory() instead
>> hasExpired(Object)
>> clearExpired()
>> clearExpiredFromAllCaches()
> 
> I would like this commit to be reverted, and applied later.  It's too
> soon to remove the deprecated methods.  It makes it harder to maintain
> external code.  I'd like to see this reapplied when the next release
> branch is made.
> 

Feel free to revert it, I don't feel like having a discussion about policy and what's previously been agreed upon right now.

Regards
Scott

Re: svn commit: r944179 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java

Posted by Adam Heath <do...@brainfood.com>.
lektran@apache.org wrote:
> Author: lektran
> Date: Fri May 14 09:47:14 2010
> New Revision: 944179
> 
> URL: http://svn.apache.org/viewvc?rev=944179&view=rev
> Log:
> The following deprecated methods have been removed from org.ofbiz.base.util.cache.UtilCache:
> setMaxSize(int)
> - Use setMaxInMemory(int) instead
> getMaxSize()
> - Use getMaxInMemory() instead
> hasExpired(Object)
> clearExpired()
> clearExpiredFromAllCaches()

I would like this commit to be reverted, and applied later.  It's too
soon to remove the deprecated methods.  It makes it harder to maintain
external code.  I'd like to see this reapplied when the next release
branch is made.


> 
> Modified:
>     ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
> 
> Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java?rev=944179&r1=944178&r2=944179&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java (original)
> +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java Fri May 14 09:47:14 2010
> @@ -659,23 +659,6 @@ public class UtilCache<K, V> implements 
>          this.removeMissCount.set(0);
>      }
>  
> -    /** Sets the maximum number of elements in the cache.
> -     * If 0, there is no maximum.
> -     * @param maxSize The maximum number of elements in the cache
> -     * @deprecated Use setMaxInMemory
> -     */
> -    public void setMaxSize(int maxSize) {
> -        setMaxInMemory(maxSize);
> -    }
> -
> -    /** Returns the current maximum number of elements in the cache
> -     * @return The maximum number of elements in the cache
> -     * @deprecated Use getMaxInMemory
> -     */
> -    public int getMaxSize() {
> -        return getMaxInMemory();
> -    }
> -
>      public void setMaxInMemory(int newInMemory) {
>          this.maxInMemory = newInMemory;
>          Map<Object, CacheLine<V>> oldmap = this.memoryTable;
> @@ -873,28 +856,6 @@ public class UtilCache<K, V> implements 
>          return lineInfos;
>      }
>  
> -    /** Returns a boolean specifying whether or not the element corresponding to the key has expired.
> -     * Only returns true if element is in cache and has expired. Error conditions return false, if no expireTable entry, returns true.
> -     * Always returns false if expireTime <= 0.
> -     * Also, if SoftReference in the CacheLine object has been cleared by the gc return true.
> -     *
> -     * @param key The key for the element, used to reference it in the hastables and LRU linked list
> -     * @return True is the element corresponding to the specified key has expired, otherwise false
> -     * @deprecated elements are automatically expired in the background
> -     */
> -    @Deprecated
> -    public boolean hasExpired(Object key) {
> -        return !memoryTable.containsKey(fromKey(key));
> -    }
> -
> -    /** Clears all expired cache entries; also clear any cache entries where the SoftReference in the CacheLine object has been cleared by the gc
> -     * @deprecated entries are removed automatically now
> -    */
> -    @Deprecated
> -    public void clearExpired() {
> -        // do nothing, expired values are removed automatically in the background
> -    }
> -
>      /** Send a key addition event to all registered listeners */
>      protected void noteAddition(K key, V newValue) {
>          for (CacheListener<K, V> listener: listeners) {
> @@ -926,14 +887,6 @@ public class UtilCache<K, V> implements 
>          listeners.remove(listener);
>      }
>  
> -    /** Clears all expired cache entries from all caches
> -     * @deprecated entries are removed automatically now
> -    */
> -    @Deprecated
> -    public static void clearExpiredFromAllCaches() {
> -        // do nothing, expired values are removed automatically in the background
> -    }
> -
>      /** Checks for a non-expired key in a specific cache */
>      public static boolean validKey(String cacheName, Object key) {
>          UtilCache<?, ?> cache = findCache(cacheName);
> 
>