activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1084533 - in /activemq/trunk: activemq-core/src/main/java/org/apache/activemq/kaha/impl/ activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/ activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/ activemq-core/src/ma...
Date Wed, 23 Mar 2011 10:43:21 GMT
Author: dejanb
Date: Wed Mar 23 10:43:21 2011
New Revision: 1084533

URL: http://svn.apache.org/viewvc?rev=1084533&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3237 - FileLock.tryLock() doesn't work well in all
environments

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/ControlFile.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/IndexManager.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
    activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LockFile.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java?rev=1084533&r1=1084532&r2=1084533&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java
Wed Mar 23 10:43:21 2011
@@ -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

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/ControlFile.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/ControlFile.java?rev=1084533&r1=1084532&r2=1084533&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/ControlFile.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/ControlFile.java
Wed Mar 23 10:43:21 2011
@@ -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);
             }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/IndexManager.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/IndexManager.java?rev=1084533&r1=1084532&r2=1084533&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/IndexManager.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/IndexManager.java
Wed Mar 23 10:43:21 2011
@@ -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);
     }
 
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java?rev=1084533&r1=1084532&r2=1084533&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
Wed Mar 23 10:43:21 2011
@@ -1091,7 +1091,7 @@ public class AMQPersistenceAdapter imple
             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 {

Modified: activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LockFile.java
URL: http://svn.apache.org/viewvc/activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LockFile.java?rev=1084533&r1=1084532&r2=1084533&view=diff
==============================================================================
--- activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LockFile.java (original)
+++ activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LockFile.java Wed Mar 23 10:43:21
2011
@@ -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) {



Mime
View raw message