|
@@ -50,24 +50,49 @@ public class AppUpgradeService extends SimpleDaemon { |
|
|
@Autowired private RuleDriverDAO driverDAO; |
|
|
@Autowired private RuleDriverDAO driverDAO; |
|
|
@Autowired private StandardRuleEngineService ruleEngine; |
|
|
@Autowired private StandardRuleEngineService ruleEngine; |
|
|
|
|
|
|
|
|
|
|
|
public boolean shouldRun () { |
|
|
|
|
|
final BubbleNetwork thisNetwork = configuration.getThisNetwork(); |
|
|
|
|
|
if (thisNetwork == null) { |
|
|
|
|
|
log.warn("shouldRun: thisNetwork is null, not running"); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
final BubbleNode thisNode = configuration.getThisNode(); |
|
|
|
|
|
if (thisNode == null) { |
|
|
|
|
|
log.warn("shouldRun: thisNode is null, not running"); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
final BubbleNode sageNode = configuration.getSageNode(); |
|
|
|
|
|
if (sageNode == null) { |
|
|
|
|
|
log.warn("shouldRun: sageNode is null, not running"); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
if (sageNode.getUuid().equals(thisNode.getUuid())) { |
|
|
|
|
|
log.warn("shouldRun: sageNode is thisNode, not running"); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override protected void process() { |
|
|
@Override protected void process() { |
|
|
final BubbleNetwork thisNetwork = configuration.getThisNetwork(); |
|
|
final BubbleNetwork thisNetwork = configuration.getThisNetwork(); |
|
|
if (thisNetwork == null) { |
|
|
if (thisNetwork == null) { |
|
|
log.warn("process: thisNetwork is null, not running"); |
|
|
log.warn("process: thisNetwork is null, not running"); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
final BubbleNode thisNode = configuration.getThisNode(); |
|
|
final BubbleNode thisNode = configuration.getThisNode(); |
|
|
if (thisNode == null) { |
|
|
if (thisNode == null) { |
|
|
log.warn("process: thisNode is null, not running"); |
|
|
log.warn("process: thisNode is null, not running"); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
final BubbleNode sageNode = configuration.getSageNode(); |
|
|
final BubbleNode sageNode = configuration.getSageNode(); |
|
|
if (sageNode == null) { |
|
|
if (sageNode == null) { |
|
|
log.warn("process: sageNode is null, not running"); |
|
|
log.warn("process: sageNode is null, not running"); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
if (sageNode.getUuid().equals(thisNode.getUuid())) { |
|
|
|
|
|
log.warn("process: sageNode is thisNode, not running"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// excluding sage, are we the oldest running node? |
|
|
// excluding sage, are we the oldest running node? |
|
|
final List<BubbleNode> nodes = nodeDAO.findRunningByNetwork(thisNetwork.getUuid()).stream() |
|
|
final List<BubbleNode> nodes = nodeDAO.findRunningByNetwork(thisNetwork.getUuid()).stream() |
|
|