commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1670668 - /commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java
Date Wed, 01 Apr 2015 15:18:52 GMT
Author: tv
Date: Wed Apr  1 15:18:51 2015
New Revision: 1670668

URL: http://svn.apache.org/r1670668
Log:
Fix JCS-144: BlockDiskCache hangs on SEVERE: Region [TMS] Failure getting from disk--IOException

Modified:
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java?rev=1670668&r1=1670667&r2=1670668&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java
(original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCache.java
Wed Apr  1 15:18:51 2015
@@ -327,15 +327,21 @@ public class BlockDiskCache<K, V>
         }
 
         ICacheElement<K, V> object = null;
-        storageLock.readLock().lock();
+
 
         try
         {
-            int[] ded = this.keyStore.get( key );
-            if ( ded != null )
-            {
-                object = this.dataFile.read( ded );
+            storageLock.readLock().lock();
+            try {
+                int[] ded = this.keyStore.get( key );
+                if ( ded != null )
+                {
+                    object = this.dataFile.read( ded );
+                }
+            } finally {
+                storageLock.readLock().unlock();
             }
+
         }
         catch ( IOException ioe )
         {
@@ -346,11 +352,6 @@ public class BlockDiskCache<K, V>
         {
             log.error( logCacheName + "Failure getting from disk, key = " + key, e );
         }
-        finally
-        {
-            storageLock.readLock().unlock();
-        }
-
         return object;
     }
 



Mime
View raw message