Author: chirino
Date: Thu Feb 7 09:13:03 2008
New Revision: 619511
URL: http://svn.apache.org/viewvc?rev=619511&view=rev
Log:
Handle the OverlappingFileLockException that could occur.
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/ControlFile.java
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=619511&r1=619510&r2=619511&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
Thu Feb 7 09:13:03 2008
@@ -20,8 +20,10 @@
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileLock;
+import java.nio.channels.OverlappingFileLockException;
import org.apache.activemq.util.ByteSequence;
+import org.apache.activemq.util.IOExceptionSupport;
/**
* Use to reliably store fixed sized state data. It stores the state in record
@@ -72,7 +74,11 @@
}
if (lock == null) {
- lock = randomAccessFile.getChannel().tryLock();
+ try {
+ lock = randomAccessFile.getChannel().tryLock();
+ } catch (OverlappingFileLockException e) {
+ throw IOExceptionSupport.create("Control file '" + file + "'
could not be locked.",e);
+ }
if (lock == null) {
throw new IOException("Control file '" + file + "' could not
be locked.");
}