Class FileBackedClusterInfoManager
- java.lang.Object
-
- com.atlassian.bamboo.cluster.state.FileBackedClusterInfoManager
-
- All Implemented Interfaces:
ClusterInfoManager
@Internal public class FileBackedClusterInfoManager extends Object implements ClusterInfoManager
-
-
Constructor Summary
Constructors Constructor Description FileBackedClusterInfoManager(BambooClusterLockService bambooClusterLockService, XStreamManager xStreamManage, BambooClusterNodeHeartbeatService bambooClusterNodeHeartbeatService, CrossNodesRemoteBroadcaster crossNodesRemoteBroadcaster)
FileBackedClusterInfoManager(BambooClusterLockService bambooClusterLockService, XStreamManager xStreamManager, BambooClusterNodeHeartbeatService bambooClusterNodeHeartbeatService, CrossNodesRemoteBroadcaster crossNodesRemoteBroadcaster, File clusterInfoDirectory, boolean initialStartedValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createInitialStateIfMissing()
BE CAREFUL when calling outside the BambooContainer context.@NotNull Optional<ClusterInfoData>
getBufferedClusterInfoData()
@NotNull Optional<ClusterInfoData>
getClusterInfoData()
void
refreshBufferedClusterInfoData()
Refreshes the cluster info caches.boolean
setLifecycle(@NotNull NodeLifecycleState nodeLifecycleState)
Sets theNodeLifecycleState
coming from the current node.
-
-
-
Constructor Detail
-
FileBackedClusterInfoManager
public FileBackedClusterInfoManager(BambooClusterLockService bambooClusterLockService, XStreamManager xStreamManage, BambooClusterNodeHeartbeatService bambooClusterNodeHeartbeatService, CrossNodesRemoteBroadcaster crossNodesRemoteBroadcaster)
-
FileBackedClusterInfoManager
@VisibleForTesting public FileBackedClusterInfoManager(BambooClusterLockService bambooClusterLockService, XStreamManager xStreamManager, BambooClusterNodeHeartbeatService bambooClusterNodeHeartbeatService, CrossNodesRemoteBroadcaster crossNodesRemoteBroadcaster, File clusterInfoDirectory, boolean initialStartedValue)
-
-
Method Detail
-
refreshBufferedClusterInfoData
public void refreshBufferedClusterInfoData()
Description copied from interface:ClusterInfoManager
Refreshes the cluster info caches.- Specified by:
refreshBufferedClusterInfoData
in interfaceClusterInfoManager
-
createInitialStateIfMissing
public void createInitialStateIfMissing()
BE CAREFUL when calling outside the BambooContainer context. This method for a primary node will always recreate the file with its initial state. This may lead to the cluster corruption.- Specified by:
createInitialStateIfMissing
in interfaceClusterInfoManager
-
getClusterInfoData
@NotNull public @NotNull Optional<ClusterInfoData> getClusterInfoData()
- Specified by:
getClusterInfoData
in interfaceClusterInfoManager
- Returns:
- gets the current
ClusterInfoData
if present, empty otherwise
-
getBufferedClusterInfoData
@NotNull public @NotNull Optional<ClusterInfoData> getBufferedClusterInfoData()
- Specified by:
getBufferedClusterInfoData
in interfaceClusterInfoManager
- Returns:
- gets the eventually consistent
ClusterInfoData
if present, empty otherwise
-
setLifecycle
public boolean setLifecycle(@NotNull @NotNull NodeLifecycleState nodeLifecycleState)
Description copied from interface:ClusterInfoManager
Sets theNodeLifecycleState
coming from the current node. Based on implementation, the node lifecycle states might be internally mapped to different cluster states or not affect the cluster state at all.- Specified by:
setLifecycle
in interfaceClusterInfoManager
- Parameters:
nodeLifecycleState
- new lifecycle state originating from node- Returns:
- true if the state was changed, false otherwise
-
-