}
throw new FileLockException( e.getMessage(), e );
}
- catch ( Throwable e )
+ catch ( IllegalStateException e )
{
+ // Ignore this
+ log.debug( "openLock {}:{}", e.getClass(), e.getMessage() );
+ } catch (Throwable t) {
if (lock!=null && lock.isValid()) {
try {
lock.close();
} catch (IOException ex) {
// Ignore
- } finally {
- lock = null;
}
}
- log.debug( "openLock {}:{}", e.getClass(), e.getMessage() );
+ throw t;
}
}
Lock current = lockFiles.putIfAbsent( file, lock );
+ if (lock!=null && lock != current) {
+ try {
+ lock.close();
+ } catch (IOException e) {
+ // ignore
+ }
+
+ }
if ( current != null )
{
lock = current;
}
+
return lock;
public void thread9()
throws FileLockException, FileLockTimeoutException, IOException
{
- logger.info( "thread7" );
+ logger.info( "thread9" );
Lock lock = fileLockManager.writeFileLock( this.file );
try
{
{
fileLockManager.release( lock );
}
- logger.info( "thread8 ok" );
+ logger.info( "thread10 ok" );
success.incrementAndGet();
}