Class FileBasedNodeManager
- java.lang.Object
-
- org.apache.activemq.artemis.core.server.NodeManager
-
- org.apache.activemq.artemis.core.server.impl.FileBasedNodeManager
-
- All Implemented Interfaces:
ActiveMQComponent
- Direct Known Subclasses:
FileLockNodeManager,InVMNodeManager
public abstract class FileBasedNodeManager extends NodeManager
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.activemq.artemis.core.server.NodeManager
NodeManager.LockListener, NodeManager.NodeManagerException
-
-
Field Summary
Fields Modifier and Type Field Description protected FileChannelactivationSequenceChannelprotected FileChannelchannelprotected static byteFIRST_TIME_STARTstatic StringSERVER_ACTIVATION_SEQUENCE_NAMEstatic StringSERVER_LOCK_NAMEprotected FileserverLockFile-
Fields inherited from class org.apache.activemq.artemis.core.server.NodeManager
nodeActivationSequence, nodeIDGuard, NULL_NODE_ACTIVATION_SEQUENCE, replicatedBackup
-
-
Constructor Summary
Constructors Constructor Description FileBasedNodeManager(boolean replicatedBackup, File directory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcreateNodeId()protected FilenewFile(String fileName)longreadNodeActivationSequence()protected voidsetUpServerLockFile()Ensures existence of persistent information about the server's nodeID.voidstop()voidstopBackup()voidwriteNodeActivationSequence(long sequence)-
Methods inherited from class org.apache.activemq.artemis.core.server.NodeManager
awaitLiveNode, awaitLiveStatus, checkStarted, crashLiveServer, getNodeActivationSequence, getNodeId, getUUID, interrupt, isAwaitingFailback, isBackupLive, isStarted, notifyLostLock, pauseLiveServer, readNodeId, registerLockListener, releaseBackup, setNodeActivationSequence, setNodeID, setUUID, start, startBackup, startLiveNode, unregisterLockListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.artemis.core.server.ActiveMQComponent
asyncStop
-
-
-
-
Field Detail
-
FIRST_TIME_START
protected static final byte FIRST_TIME_START
- See Also:
- Constant Field Values
-
SERVER_LOCK_NAME
public static final String SERVER_LOCK_NAME
- See Also:
- Constant Field Values
-
SERVER_ACTIVATION_SEQUENCE_NAME
public static final String SERVER_ACTIVATION_SEQUENCE_NAME
- See Also:
- Constant Field Values
-
serverLockFile
protected File serverLockFile
-
channel
protected FileChannel channel
-
activationSequenceChannel
protected FileChannel activationSequenceChannel
-
-
Constructor Detail
-
FileBasedNodeManager
public FileBasedNodeManager(boolean replicatedBackup, File directory)
-
-
Method Detail
-
readNodeActivationSequence
public long readNodeActivationSequence() throws NodeManager.NodeManagerException- Overrides:
readNodeActivationSequencein classNodeManager- Throws:
NodeManager.NodeManagerException
-
writeNodeActivationSequence
public void writeNodeActivationSequence(long sequence) throws NodeManager.NodeManagerException- Overrides:
writeNodeActivationSequencein classNodeManager- Throws:
NodeManager.NodeManagerException
-
setUpServerLockFile
protected void setUpServerLockFile() throws IOExceptionEnsures existence of persistent information about the server's nodeID.Roughly the different use cases are:
- old live server restarts: a server.lock file already exists and contains a nodeID.
- new live server starting for the first time: no file exists, and we just *create* a new UUID to use as nodeID
- replicated backup received its nodeID from its live: no file exists, we need to persist the *current* nodeID
- Throws:
IOException
-
createNodeId
protected final void createNodeId() throws IOException- Throws:
IOException
-
stop
public void stop() throws Exception- Specified by:
stopin interfaceActiveMQComponent- Overrides:
stopin classNodeManager- Throws:
Exception
-
stopBackup
public void stopBackup() throws NodeManager.NodeManagerException- Overrides:
stopBackupin classNodeManager- Throws:
NodeManager.NodeManagerException
-
-