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 voidcreateInitialStateIfMissing()BE CAREFUL when calling outside the BambooContainer context.@NotNull Optional<ClusterInfoData>getBufferedClusterInfoData()@NotNull Optional<ClusterInfoData>getClusterInfoData()voidrefreshBufferedClusterInfoData()Refreshes the cluster info caches.booleansetLifecycle(@NotNull NodeLifecycleState nodeLifecycleState)Sets theNodeLifecycleStatecoming 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:ClusterInfoManagerRefreshes the cluster info caches.- Specified by:
refreshBufferedClusterInfoDatain 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:
createInitialStateIfMissingin interfaceClusterInfoManager
-
getClusterInfoData
@NotNull public @NotNull Optional<ClusterInfoData> getClusterInfoData()
- Specified by:
getClusterInfoDatain interfaceClusterInfoManager- Returns:
- gets the current
ClusterInfoDataif present, empty otherwise
-
getBufferedClusterInfoData
@NotNull public @NotNull Optional<ClusterInfoData> getBufferedClusterInfoData()
- Specified by:
getBufferedClusterInfoDatain interfaceClusterInfoManager- Returns:
- gets the eventually consistent
ClusterInfoDataif present, empty otherwise
-
setLifecycle
public boolean setLifecycle(@NotNull @NotNull NodeLifecycleState nodeLifecycleState)Description copied from interface:ClusterInfoManagerSets theNodeLifecycleStatecoming 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:
setLifecyclein interfaceClusterInfoManager- Parameters:
nodeLifecycleState- new lifecycle state originating from node- Returns:
- true if the state was changed, false otherwise
-
-