Author: j16sdiz
Date: 2008-09-24 15:00:42 +0000 (Wed, 24 Sep 2008)
New Revision: 22795

Modified:
   trunk/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
Log:
time out lock in 10 second

Modified: trunk/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
===================================================================
--- trunk/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java      
2008-09-24 11:57:05 UTC (rev 22794)
+++ trunk/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java      
2008-09-24 15:00:42 UTC (rev 22795)
@@ -178,7 +178,8 @@
                if (logMINOR)
                        Logger.minor(this, "Fetch " + 
HexUtil.bytesToHex(routingKey) + " for " + callback);

-               configLock.readLock().lock();
+               if (!configLock.readLock().tryLock(10, TimeUnit.SECOND))
+                       return null;
                try {
                        Map<Long, Condition> lockMap = lockPlainKey(routingKey, 
true);
                        if (lockMap == null) {
@@ -265,7 +266,8 @@
                if (logMINOR)
                        Logger.minor(this, "Putting " + 
HexUtil.bytesToHex(routingKey) + " (" + name + ")");

-               configLock.readLock().lock();
+               if (!configLock.readLock().tryLock(10, TimeUnit.SECOND))
+                       throw new IOException("can't lock in 10 seconds");
                try {
                        Map<Long, Condition> lockMap = lockPlainKey(routingKey, 
false);
                        if (lockMap == null) {


Reply via email to