activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r393039 - /incubator/activemq/trunk/activeio/activeio-core/src/main/java/org/apache/activeio/journal/active/ControlFile.java
Date Mon, 10 Apr 2006 20:03:47 GMT
Author: chirino
Date: Mon Apr 10 13:03:46 2006
New Revision: 393039

URL: http://svn.apache.org/viewcvs?rev=393039&view=rev
Log:
The file lock implementation on some JVM/OS combinations is broken.  See:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4883030
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4854085 

If -Djava.nio.channels.FileLock.broken=true is now passed as an argument to the JVM, the actveio
journal will avoid using that file locking APIs.

Modified:
    incubator/activemq/trunk/activeio/activeio-core/src/main/java/org/apache/activeio/journal/active/ControlFile.java

Modified: incubator/activemq/trunk/activeio/activeio-core/src/main/java/org/apache/activeio/journal/active/ControlFile.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activeio/activeio-core/src/main/java/org/apache/activeio/journal/active/ControlFile.java?rev=393039&r1=393038&r2=393039&view=diff
==============================================================================
--- incubator/activemq/trunk/activeio/activeio-core/src/main/java/org/apache/activeio/journal/active/ControlFile.java
(original)
+++ incubator/activemq/trunk/activeio/activeio-core/src/main/java/org/apache/activeio/journal/active/ControlFile.java
Mon Apr 10 13:03:46 2006
@@ -43,6 +43,7 @@
     private final RandomAccessFile file;
     private final FileChannel channel;
     private final ByteBufferPacket controlData;
+    private final static boolean brokenFileLock = "true".equals(System.getProperty("java.nio.channels.FileLock.broken",
"false"));
 
     private long controlDataVersion=0;
     private FileLock lock;
@@ -71,10 +72,12 @@
                     throw new IOException("Journal is already opened by this application.");
                 }
 
-                lock = channel.tryLock();
-                if (lock == null) {
-                    set.remove(canonicalPath);
-                    throw new IOException("Journal is already opened by another application");
+                if( !brokenFileLock ) {
+                    lock = channel.tryLock();
+                    if (lock == null) {
+                        set.remove(canonicalPath);
+                        throw new IOException("Journal is already opened by another application");
+                    }
                 }
             }
         }



Mime
View raw message