mirror of https://github.com/apache/archiva.git
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:
parent
6fee2f195f
commit
4e077a844e
|
@ -65,7 +65,7 @@ public class DefaultFileLockManager
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
Lock lock = new Lock( file, false );
|
Lock lock = null;
|
||||||
|
|
||||||
stopWatch.start();
|
stopWatch.start();
|
||||||
|
|
||||||
|
@ -84,6 +84,8 @@ public class DefaultFileLockManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lock = new Lock( file, false );
|
||||||
|
|
||||||
Lock current = lockFiles.get( file );
|
Lock current = lockFiles.get( file );
|
||||||
|
|
||||||
if ( current != null )
|
if ( current != null )
|
||||||
|
@ -143,12 +145,13 @@ public class DefaultFileLockManager
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Lock lock = new Lock( file, true );
|
Lock lock = null;
|
||||||
|
|
||||||
stopWatch.start();
|
stopWatch.start();
|
||||||
|
|
||||||
while ( !acquired )
|
while ( !acquired )
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( timeout > 0 )
|
if ( timeout > 0 )
|
||||||
{
|
{
|
||||||
long delta = stopWatch.getTime();
|
long delta = stopWatch.getTime();
|
||||||
|
@ -161,6 +164,8 @@ public class DefaultFileLockManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lock = new Lock( file, true );
|
||||||
|
|
||||||
Lock current = lockFiles.get( file );
|
Lock current = lockFiles.get( file );
|
||||||
|
|
||||||
if ( current != null )
|
if ( current != null )
|
||||||
|
|
Loading…
Reference in New Issue