mirror of https://github.com/apache/activemq.git
Handle the OverlappingFileLockException that could occur.
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@619511 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
52ca2de3f0
commit
939a3160f3
|
@ -20,8 +20,10 @@ import java.io.File;
|
|||
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 @@ public final class ControlFile {
|
|||
}
|
||||
|
||||
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.");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue