ozeigermann    2004/07/22 01:39:35

  Modified:    src/share/org/apache/slide/util
                        ByteSizeLimitedObjectCache.java
  Log:
  Applied fix sugested by Tara Talbott in
  http://issues.apache.org/bugzilla/show_bug.cgi?id=30243
  
  Revision  Changes    Path
  1.4       +12 -16    
jakarta-slide/src/share/org/apache/slide/util/ByteSizeLimitedObjectCache.java
  
  Index: ByteSizeLimitedObjectCache.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/util/ByteSizeLimitedObjectCache.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ByteSizeLimitedObjectCache.java   25 Feb 2004 13:10:19 -0000      1.3
  +++ ByteSizeLimitedObjectCache.java   22 Jul 2004 08:39:35 -0000      1.4
  @@ -220,23 +220,19 @@
                   freeBytes(key);
   
                   // ok, we decided to cache this entry, make room for it
  -                for (int i = 0; globalSize + byteSize > maxByteSize && i < 
MAX_FREEING_TRIES; i++)
  +                for (int i = 0; globalSize + byteSize > maxByteSize && i < 
MAX_FREEING_TRIES; i++) {
                       if (loggingEnabled) {
  -                        logger.log(
  -                            txId
  -                                + " for '"
  -                                + key
  -                                + "' needs "
  +                        logger.log(txId + " for '" + key + "' needs "
                                   + Long.toString(globalSize + byteSize - maxByteSize)
  -                                + " bytes more to be cached. Freeing bytes!",
  -                            logChannel,
  -                            Logger.DEBUG);
  +                                + " bytes more to be cached. Freeing bytes!", 
logChannel, Logger.DEBUG);
                       }
  -                // this will call back processRemovedLRU and will thus free bytes 
  -                removeLRU();
  +                    // this will call back processRemovedLRU and will thus free
  +                    // bytes
  +                    removeLRU();
  +                }
               }
               // was this successful?
  -            if (globalSize + byteSize > maxByteSize) {
  +            if (globalSize + byteSize <= maxByteSize) {
                   shadowSizes.put(key, new Long(byteSize));
                   globalSize += byteSize;
                   return super.put(key, value);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to