Package com.atlassian.bamboo.beehive
Class PrimaryNodeServiceImpl
- java.lang.Object
-
- com.atlassian.bamboo.beehive.PrimaryNodeServiceImpl
-
- All Implemented Interfaces:
PrimaryNodeService
public class PrimaryNodeServiceImpl extends Object implements PrimaryNodeService
-
-
Field Summary
Fields Modifier and Type Field Description static intACQUIRE_PRIMARY_NODE_LOCK_JOB_INTERVAL_SECONDSstatic intNUMBER_OF_LEGIT_FAILED_ATTEMPTS_BEFORE_GIVING_UPstatic longPRIMARY_CLUSTER_LOCK_TIMEOUT_SECONDSstatic StringPRIMARY_NODE_LOCK_NAMEstatic intTIMEOUT_TO_INTERVAL_RATIO
-
Constructor Summary
Constructors Constructor Description PrimaryNodeServiceImpl(@NotNull ClusterNodeHeartbeatDao clusterNodeHeartbeatDao, @NotNull AutowiringJobFactory bootstrapJobFactory, @NotNull BambooClusterLockServiceImpl bambooClusterLockService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidjoinPrimaryNodeElection()Acquire primary node lock, or go into secondary node mode if the primary lock is held by another node.voidshutdown()Shutdown the service.
-
-
-
Field Detail
-
PRIMARY_NODE_LOCK_NAME
public static final String PRIMARY_NODE_LOCK_NAME
- See Also:
- Constant Field Values
-
PRIMARY_CLUSTER_LOCK_TIMEOUT_SECONDS
public static final long PRIMARY_CLUSTER_LOCK_TIMEOUT_SECONDS
-
TIMEOUT_TO_INTERVAL_RATIO
public static final int TIMEOUT_TO_INTERVAL_RATIO
- See Also:
- Constant Field Values
-
NUMBER_OF_LEGIT_FAILED_ATTEMPTS_BEFORE_GIVING_UP
public static final int NUMBER_OF_LEGIT_FAILED_ATTEMPTS_BEFORE_GIVING_UP
- See Also:
- Constant Field Values
-
ACQUIRE_PRIMARY_NODE_LOCK_JOB_INTERVAL_SECONDS
public static final int ACQUIRE_PRIMARY_NODE_LOCK_JOB_INTERVAL_SECONDS
-
-
Constructor Detail
-
PrimaryNodeServiceImpl
public PrimaryNodeServiceImpl(@NotNull @NotNull ClusterNodeHeartbeatDao clusterNodeHeartbeatDao, @NotNull @NotNull AutowiringJobFactory bootstrapJobFactory, @NotNull @NotNull BambooClusterLockServiceImpl bambooClusterLockService) throws org.quartz.SchedulerException- Throws:
org.quartz.SchedulerException
-
-
Method Detail
-
joinPrimaryNodeElection
public void joinPrimaryNodeElection() throws org.quartz.SchedulerExceptionDescription copied from interface:PrimaryNodeServiceAcquire primary node lock, or go into secondary node mode if the primary lock is held by another node. Care - this method starts the background job, therefore even the very first run is asynchronous and there is no guarantee that once this method returns the lock acquisition is complete.- Specified by:
joinPrimaryNodeElectionin interfacePrimaryNodeService- Throws:
org.quartz.SchedulerException
-
shutdown
@PreDestroy public void shutdown()
Description copied from interface:PrimaryNodeServiceShutdown the service.- Specified by:
shutdownin interfacePrimaryNodeService
-
-