prevent possible race condition if the file has been deleted

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1551109 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-12-16 03:35:55 +00:00
parent 6fee2f195f
commit 4e077a844e
1 changed files with 7 additions and 2 deletions

View File

@ -65,7 +65,7 @@ public class DefaultFileLockManager
try
{
Lock lock = new Lock( file, false );
Lock lock = null;
stopWatch.start();
@ -84,6 +84,8 @@ public class DefaultFileLockManager
}
}
lock = new Lock( file, false );
Lock current = lockFiles.get( file );
if ( current != null )
@ -143,12 +145,13 @@ public class DefaultFileLockManager
try
{
Lock lock = new Lock( file, true );
Lock lock = null;
stopWatch.start();
while ( !acquired )
{
if ( timeout > 0 )
{
long delta = stopWatch.getTime();
@ -161,6 +164,8 @@ public class DefaultFileLockManager
}
}
lock = new Lock( file, true );
Lock current = lockFiles.get( file );
if ( current != null )