mirror of https://github.com/apache/activemq.git
fix file lock usage in kahadb store, so shared file system master slave can work
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@783364 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fbddf4f868
commit
a88a513e3c
|
@ -229,7 +229,7 @@ public class MessageDatabase {
|
|||
lockFile.lock();
|
||||
break;
|
||||
} catch (IOException e) {
|
||||
LOG.info("Database "+lockFileName+" is locked... waiting " + (DATABASE_LOCKED_WAIT_DELAY / 1000) + " seconds for the database to be unlocked.");
|
||||
LOG.info("Database "+lockFileName+" is locked... waiting " + (DATABASE_LOCKED_WAIT_DELAY / 1000) + " seconds for the database to be unlocked. Reason: " + e);
|
||||
try {
|
||||
Thread.sleep(DATABASE_LOCKED_WAIT_DELAY);
|
||||
} catch (InterruptedException e1) {
|
||||
|
|
|
@ -50,8 +50,7 @@ public class LockFile {
|
|||
return;
|
||||
}
|
||||
|
||||
lockCounter++;
|
||||
if( lockCounter!=1 ) {
|
||||
if( lockCounter>0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -63,9 +62,12 @@ public class LockFile {
|
|||
} catch (OverlappingFileLockException e) {
|
||||
throw IOExceptionSupport.create("File '" + file + "' could not be locked.",e);
|
||||
}
|
||||
if (lock == null) {
|
||||
if (lock != null) {
|
||||
lockCounter++;
|
||||
} else {
|
||||
throw new IOException("File '" + file + "' could not be locked.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue