mirror of
https://github.com/apache/archiva.git
synced 2025-02-07 02:29:23 +00:00
prevent possible file limit issue
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1551121 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4e077a844e
commit
c2d4f8bce1
@ -27,6 +27,7 @@
|
||||
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 Lock readFileLock( File file )
|
||||
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 Lock writeFileLock( File file )
|
||||
|
||||
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;
|
||||
|
@ -144,6 +144,10 @@ protected void openLock( boolean write, boolean timeout )
|
||||
|
||||
}
|
||||
|
||||
protected RandomAccessFile getRandomAccessFile()
|
||||
{
|
||||
return randomAccessFile;
|
||||
}
|
||||
|
||||
private void closeQuietly( Closeable closeable )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user