mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-3237 - FileLock.tryLock() doesn't work well in all environments
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1084533 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8d65328f0f
commit
68bcac109a
|
@ -499,7 +499,7 @@ public class KahaStore implements Store {
|
|||
String property = System.getProperty(key);
|
||||
if (null == property) {
|
||||
if (!BROKEN_FILE_LOCK) {
|
||||
lock = lockFile.getChannel().tryLock();
|
||||
lock = lockFile.getChannel().tryLock(0, lockFile.getChannel().size(), false);
|
||||
if (lock == null) {
|
||||
throw new StoreLockedExcpetion("Kaha Store " + directory.getName() + " is already opened by another application");
|
||||
} else
|
||||
|
|
|
@ -75,7 +75,7 @@ public final class ControlFile {
|
|||
|
||||
if (lock == null) {
|
||||
try {
|
||||
lock = randomAccessFile.getChannel().tryLock();
|
||||
lock = randomAccessFile.getChannel().tryLock(0, randomAccessFile.getChannel().size(), false);
|
||||
} catch (OverlappingFileLockException e) {
|
||||
throw IOExceptionSupport.create("Control file '" + file + "' could not be locked.",e);
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ public final class IndexManager {
|
|||
}
|
||||
|
||||
public synchronized FileLock getLock() throws IOException {
|
||||
return indexFile.getChannel().tryLock();
|
||||
return indexFile.getChannel().tryLock(0, indexFile.getChannel().size(), false);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1091,7 +1091,7 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener,
|
|||
String property = System.getProperty(key);
|
||||
if (null == property) {
|
||||
if (!BROKEN_FILE_LOCK) {
|
||||
lock = lockFile.getChannel().tryLock();
|
||||
lock = lockFile.getChannel().tryLock(0, lockFile.getChannel().size(), false);
|
||||
if (lock == null) {
|
||||
result = false;
|
||||
} else {
|
||||
|
|
|
@ -63,7 +63,7 @@ public class LockFile {
|
|||
readFile = new RandomAccessFile(file, "rw");
|
||||
IOException reason = null;
|
||||
try {
|
||||
lock = readFile.getChannel().tryLock();
|
||||
lock = readFile.getChannel().tryLock(0, readFile.getChannel().size(), false);
|
||||
} catch (OverlappingFileLockException e) {
|
||||
reason = IOExceptionSupport.create("File '" + file + "' could not be locked.",e);
|
||||
} catch (IOException ioe) {
|
||||
|
|
Loading…
Reference in New Issue