This commit is contained in:
Clebert Suconic 2019-12-05 15:54:27 -05:00
commit d2215aa7e3
2 changed files with 11 additions and 2 deletions

View File

@ -30,7 +30,7 @@ import org.apache.activemq.artemis.utils.UUIDGenerator;
public abstract class NodeManager implements ActiveMQComponent {
protected static final byte FIRST_TIME_START = '0';
private static final String SERVER_LOCK_NAME = "server.lock";
public static final String SERVER_LOCK_NAME = "server.lock";
private static final String ACCESS_MODE = "rw";
protected final boolean replicatedBackup;

View File

@ -108,7 +108,16 @@ public class FileLockNodeManager extends NodeManager {
protected synchronized void setUpServerLockFile() throws IOException {
super.setUpServerLockFile();
for (int i = 0; i < 3; i++) {
if (lockChannels[0] == null || !lockChannels[0].isOpen()) {
File fileLock = newFile(NodeManager.SERVER_LOCK_NAME);
if (!fileLock.exists()) {
fileLock.createNewFile();
}
RandomAccessFile randomFileLock = new RandomAccessFile(fileLock, "rw");
lockChannels[0] = randomFileLock.getChannel();
}
for (int i = 1; i < 3; i++) {
if (lockChannels[i] != null && lockChannels[i].isOpen()) {
continue;
}