@Service(value="blScheduledDeployManager") @ManagedResource(objectName="org.broadleafcommerce:name=ScheduledDeployManager", description="Manages processing of scheduled deployments", currencyTimeLimit=15) public class ScheduledDeployManagerImpl extends Object implements ScheduledDeployManager, org.springframework.context.ApplicationContextAware, org.springframework.context.SmartLifecycle
Modifier and Type | Field and Description |
---|---|
protected long |
abandonedHandleThresholdSeconds |
protected ConsumeWorker |
abandonedProcessWorker |
protected org.quartz.Scheduler |
consumeScheduler |
protected org.springframework.context.ApplicationContext |
context |
protected ConsumeWorker |
deployConsumeWorker |
protected ConsumeWorker |
deployHeartBeatWorker |
protected ConsumeWorker |
deployPurgeWorker |
protected Map<String,SystemEventFactory> |
eventFactories |
protected DatabaseSystemEventNode |
eventNode |
protected boolean |
isMaster |
protected boolean |
isSuspended |
protected long |
jobThreadPoolCount |
protected boolean |
masterDeployNodeEnabled |
protected long |
masterNodeHeartbeatIntervalSeconds
Number of seconds between each hearbeat check event for a node.
|
protected long |
nodePurgeIntervalSeconds
Number of seconds between each polling attempt to the database in search of defunct nodes to purge.
|
protected long |
nodePurgeThresholdSeconds
Number of seconds a node can miss heartbeat detection before determining that the node has become defunct.
|
protected boolean |
pause |
protected long |
pollingIntervalSeconds
Number of seconds between each polling attempt to the database in search of new deploy system events to process.
|
protected org.quartz.Scheduler |
scheduler |
protected DatabaseSystemEventDao |
systemEventDao |
protected org.broadleafcommerce.common.util.StreamingTransactionCapableUtil |
transUtil |
Constructor and Description |
---|
ScheduledDeployManagerImpl(DatabaseSystemEventNode eventNode) |
Modifier and Type | Method and Description |
---|---|
void |
activate(boolean enabled) |
protected void |
buildScheduler() |
Map<String,SystemEventFactory> |
getEventFactories()
Retrieve the list of factories responsible for creating
SystemEvent instances
upon job execution. |
DatabaseSystemEventNode |
getEventNode()
This ScheduledJobManager instance is also a node in the cluster.
|
long |
getJobThreadPoolCount()
The number of Quartz thread available for jobs execution.
|
long |
getMasterNodeHeartbeatIntervalSeconds()
The amount of time between each heartbeat update for this node, if active.
|
long |
getNodePurgeIntervalSeconds()
The amount of time between each master purge attempt.
|
long |
getNodePurgeThresholdSeconds()
The amount of time an active master is allowed to not update it's heartbeat status before being a purge candidate.
|
int |
getPhase() |
org.quartz.Scheduler |
getScheduler()
Retrieve the internal Quartz scheduler instance.
|
boolean |
isAutoStartup() |
boolean |
isMaster() |
boolean |
isMaster(boolean confirmStillMasterNode)
Verifies that the current eventNode is the masterDeployNode by retrieving the node designated as master and double checking.
|
boolean |
isPause()
Whether this node is paused.
|
boolean |
isRunning() |
void |
reset()
Programatically remove this node from master/active status.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setEventFactories(Map<String,SystemEventFactory> eventFactories) |
void |
setEventNode(DatabaseSystemEventNode eventNode) |
void |
setJobThreadPoolCount(long jobThreadPoolCount) |
void |
setMaster(boolean master) |
void |
setMasterNodeHeartbeatIntervalSeconds(long masterNodeHeartbeatIntervalSeconds) |
void |
setNodePurgeIntervalSeconds(long nodePurgeIntervalSeconds) |
void |
setNodePurgeThresholdSeconds(long nodePurgeThresholdSeconds) |
void |
setPause(boolean pause) |
void |
start() |
void |
stop() |
void |
stop(Runnable callback) |
protected void |
suspend(boolean pause) |
protected org.broadleafcommerce.common.util.StreamingTransactionCapableUtil transUtil
protected DatabaseSystemEventNode eventNode
protected DatabaseSystemEventDao systemEventDao
protected ConsumeWorker deployConsumeWorker
protected ConsumeWorker deployHeartBeatWorker
protected ConsumeWorker deployPurgeWorker
protected ConsumeWorker abandonedProcessWorker
@Value(value="${master.deploy.node.heartbeat.interval.seconds:10}") protected long masterNodeHeartbeatIntervalSeconds
@Value(value="${deploy.node.purge.threshold.seconds:60}") protected long nodePurgeThresholdSeconds
@Value(value="${deploy.node.purge.interval.seconds:30}") protected long nodePurgeIntervalSeconds
@Value(value="${database.deploy.event.polling.interval.seconds:5}") protected long pollingIntervalSeconds
@Value(value="${master.deploy.node.enabled:true}") protected boolean masterDeployNodeEnabled
@Value(value="${process.abandoned.handle.interval.seconds:60}") protected long abandonedHandleThresholdSeconds
protected org.springframework.context.ApplicationContext context
protected long jobThreadPoolCount
protected org.quartz.Scheduler scheduler
protected org.quartz.Scheduler consumeScheduler
protected Map<String,SystemEventFactory> eventFactories
protected boolean pause
protected boolean isMaster
protected boolean isSuspended
@Autowired public ScheduledDeployManagerImpl(@Qualifier(value="blDatabaseSystemEventNode") DatabaseSystemEventNode eventNode)
public boolean isAutoStartup()
isAutoStartup
in interface org.springframework.context.SmartLifecycle
public void stop(Runnable callback)
stop
in interface org.springframework.context.SmartLifecycle
public void start()
start
in interface org.springframework.context.Lifecycle
public boolean isRunning()
isRunning
in interface org.springframework.context.Lifecycle
public int getPhase()
getPhase
in interface org.springframework.context.Phased
getPhase
in interface org.springframework.context.SmartLifecycle
public void stop()
stop
in interface ScheduledDeployManager
stop
in interface org.springframework.context.Lifecycle
public void reset()
ScheduledDeployManager
reset
in interface ScheduledDeployManager
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public long getMasterNodeHeartbeatIntervalSeconds()
ScheduledDeployManager
getMasterNodeHeartbeatIntervalSeconds
in interface ScheduledDeployManager
public void setMasterNodeHeartbeatIntervalSeconds(long masterNodeHeartbeatIntervalSeconds)
setMasterNodeHeartbeatIntervalSeconds
in interface ScheduledDeployManager
@ManagedAttribute(description="Number of seconds a node can miss heartbeat detection before determining that the node has become defunct.", currencyTimeLimit=15) public long getNodePurgeThresholdSeconds()
ScheduledDeployManager
getNodePurgeThresholdSeconds
in interface ScheduledDeployManager
@ManagedAttribute(description="Number of seconds a node can miss heartbeat detection before determining that the node has become defunct.", currencyTimeLimit=15) public void setNodePurgeThresholdSeconds(long nodePurgeThresholdSeconds)
setNodePurgeThresholdSeconds
in interface ScheduledDeployManager
public long getNodePurgeIntervalSeconds()
ScheduledDeployManager
getNodePurgeIntervalSeconds
in interface ScheduledDeployManager
public void setNodePurgeIntervalSeconds(long nodePurgeIntervalSeconds)
setNodePurgeIntervalSeconds
in interface ScheduledDeployManager
@ManagedAttribute(description="Whether or not deploy processing is currently paused.", currencyTimeLimit=15) public boolean isPause()
ScheduledDeployManager
isPause
in interface ScheduledDeployManager
@ManagedAttribute(description="Whether or not deploy processing is currently paused.", currencyTimeLimit=15) public void setPause(boolean pause)
setPause
in interface ScheduledDeployManager
public long getJobThreadPoolCount()
ScheduledDeployManager
getJobThreadPoolCount
in interface ScheduledDeployManager
public void setJobThreadPoolCount(long jobThreadPoolCount)
setJobThreadPoolCount
in interface ScheduledDeployManager
public Map<String,SystemEventFactory> getEventFactories()
ScheduledDeployManager
SystemEvent
instances
upon job execution. Jobs, when fired, result in events. Event are then consumed, which is the end goal.getEventFactories
in interface ScheduledDeployManager
public void setEventFactories(Map<String,SystemEventFactory> eventFactories)
setEventFactories
in interface ScheduledDeployManager
public boolean isMaster()
isMaster
in interface ScheduledDeployManager
public boolean isMaster(boolean confirmStillMasterNode)
ScheduledDeployManager
setMaster()
method.isMaster
in interface ScheduledDeployManager
public void setMaster(boolean master)
setMaster
in interface ScheduledDeployManager
public void activate(boolean enabled)
activate
in interface ScheduledDeployManager
public org.quartz.Scheduler getScheduler()
ScheduledDeployManager
getScheduler
in interface ScheduledDeployManager
public DatabaseSystemEventNode getEventNode()
ScheduledDeployManager
DatabaseSystemEventNode
instance.getEventNode
in interface ScheduledDeployManager
public void setEventNode(DatabaseSystemEventNode eventNode)
setEventNode
in interface ScheduledDeployManager
protected void suspend(boolean pause)
protected void buildScheduler() throws IOException, org.quartz.SchedulerException
IOException
org.quartz.SchedulerException
Copyright © 2020. All rights reserved.