git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1089772 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2011-04-07 08:30:53 +00:00
parent 2f869e32d0
commit 47833b7fb1
5 changed files with 5 additions and 5 deletions

View File

@ -499,7 +499,7 @@ public class KahaStore implements Store {
String property = System.getProperty(key); String property = System.getProperty(key);
if (null == property) { if (null == property) {
if (!BROKEN_FILE_LOCK) { if (!BROKEN_FILE_LOCK) {
lock = lockFile.getChannel().tryLock(0, lockFile.getChannel().size(), false); lock = lockFile.getChannel().tryLock(0, Math.max(1, lockFile.getChannel().size()), false);
if (lock == null) { if (lock == null) {
throw new StoreLockedExcpetion("Kaha Store " + directory.getName() + " is already opened by another application"); throw new StoreLockedExcpetion("Kaha Store " + directory.getName() + " is already opened by another application");
} else } else

View File

@ -75,7 +75,7 @@ public final class ControlFile {
if (lock == null) { if (lock == null) {
try { try {
lock = randomAccessFile.getChannel().tryLock(0, randomAccessFile.getChannel().size(), false); lock = randomAccessFile.getChannel().tryLock(0, Math.max(1, randomAccessFile.getChannel().size()), false);
} catch (OverlappingFileLockException e) { } catch (OverlappingFileLockException e) {
throw IOExceptionSupport.create("Control file '" + file + "' could not be locked.",e); throw IOExceptionSupport.create("Control file '" + file + "' could not be locked.",e);
} }

View File

@ -188,7 +188,7 @@ public final class IndexManager {
} }
public synchronized FileLock getLock() throws IOException { public synchronized FileLock getLock() throws IOException {
return indexFile.getChannel().tryLock(0, indexFile.getChannel().size(), false); return indexFile.getChannel().tryLock(0, Math.max(1, indexFile.getChannel().size()), false);
} }

View File

@ -1094,7 +1094,7 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener,
String property = System.getProperty(key); String property = System.getProperty(key);
if (null == property) { if (null == property) {
if (!BROKEN_FILE_LOCK) { if (!BROKEN_FILE_LOCK) {
lock = lockFile.getChannel().tryLock(0, lockFile.getChannel().size(), false); lock = lockFile.getChannel().tryLock(0, Math.max(1, lockFile.getChannel().size()), false);
if (lock == null) { if (lock == null) {
result = false; result = false;
} else { } else {

View File

@ -63,7 +63,7 @@ public class LockFile {
readFile = new RandomAccessFile(file, "rw"); readFile = new RandomAccessFile(file, "rw");
IOException reason = null; IOException reason = null;
try { try {
lock = readFile.getChannel().tryLock(0, readFile.getChannel().size(), false); lock = readFile.getChannel().tryLock(0, Math.max(1, readFile.getChannel().size()), false);
} catch (OverlappingFileLockException e) { } catch (OverlappingFileLockException e) {
reason = IOExceptionSupport.create("File '" + file + "' could not be locked.",e); reason = IOExceptionSupport.create("File '" + file + "' could not be locked.",e);
} catch (IOException ioe) { } catch (IOException ioe) {