aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base/archiva-filelock/src/main
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2013-12-16 06:53:09 +0000
committerOlivier Lamy <olamy@apache.org>2013-12-16 06:53:09 +0000
commitc2d4f8bce1588f39ed80078c89939b3df746f9be (patch)
tree4afc31dee7ccd73f4ec43a0262a8f1e9ef44e946 /archiva-modules/archiva-base/archiva-filelock/src/main
parent4e077a844eccebac9cce6c37d040eae7be9ed39c (diff)
downloadarchiva-c2d4f8bce1588f39ed80078c89939b3df746f9be.tar.gz
archiva-c2d4f8bce1588f39ed80078c89939b3df746f9be.zip
prevent possible file limit issue
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1551121 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base/archiva-filelock/src/main')
-rw-r--r--archiva-modules/archiva-base/archiva-filelock/src/main/java/org/apache/archiva/common/filelock/DefaultFileLockManager.java26
-rw-r--r--archiva-modules/archiva-base/archiva-filelock/src/main/java/org/apache/archiva/common/filelock/Lock.java4
2 files changed, 24 insertions, 6 deletions
diff --git a/archiva-modules/archiva-base/archiva-filelock/src/main/java/org/apache/archiva/common/filelock/DefaultFileLockManager.java b/archiva-modules/archiva-base/archiva-filelock/src/main/java/org/apache/archiva/common/filelock/DefaultFileLockManager.java
index e97d3e141..db26076b9 100644
--- a/archiva-modules/archiva-base/archiva-filelock/src/main/java/org/apache/archiva/common/filelock/DefaultFileLockManager.java
+++ b/archiva-modules/archiva-base/archiva-filelock/src/main/java/org/apache/archiva/common/filelock/DefaultFileLockManager.java
@@ -27,6 +27,7 @@ import org.springframework.stereotype.Service;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.RandomAccessFile;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -91,6 +92,12 @@ public class DefaultFileLockManager
if ( current != null )
{
log.debug( "read lock file exist continue wait" );
+ // close RandomAccessFile!!!
+ RandomAccessFile raf = lock.getRandomAccessFile();
+ if (raf != null)
+ {
+ raf.close();
+ }
continue;
}
@@ -168,14 +175,21 @@ public class DefaultFileLockManager
Lock current = lockFiles.get( file );
- if ( current != null )
- {
- log.debug( "write lock file exist continue wait" );
- continue;
- }
-
try
{
+
+ if ( current != null )
+ {
+ log.debug( "write lock file exist continue wait" );
+ // close RandomAccessFile!!!
+ RandomAccessFile raf = lock.getRandomAccessFile();
+ if (raf != null)
+ {
+ raf.close();
+ }
+ continue;
+ }
+
createNewFileQuietly( file );
lock.openLock( true, timeout > 0 );
acquired = true;
diff --git a/archiva-modules/archiva-base/archiva-filelock/src/main/java/org/apache/archiva/common/filelock/Lock.java b/archiva-modules/archiva-base/archiva-filelock/src/main/java/org/apache/archiva/common/filelock/Lock.java
index a05d7d2c5..0922a7495 100644
--- a/archiva-modules/archiva-base/archiva-filelock/src/main/java/org/apache/archiva/common/filelock/Lock.java
+++ b/archiva-modules/archiva-base/archiva-filelock/src/main/java/org/apache/archiva/common/filelock/Lock.java
@@ -144,6 +144,10 @@ public class Lock
}
+ protected RandomAccessFile getRandomAccessFile()
+ {
+ return randomAccessFile;
+ }
private void closeQuietly( Closeable closeable )
{