summaryrefslogtreecommitdiffstats
path: root/feature-active-standby-management/src/main/java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-07-10 15:58:09 -0400
committerJim Hahn <jrh3@att.com>2019-07-17 15:21:07 -0400
commit86512b0d4e3235fca6379b3d7f3f1d8a9a5c606b (patch)
tree3a03573fc08cba42d9989cd96148012ddb5c7fd3 /feature-active-standby-management/src/main/java
parent6dee9fba7e3c471bab358d8567a9e3e0a3fca769 (diff)
Fix checkstyle issues in api-state-management
Also deleted the checkstyle suppression file. Change-Id: Ib43a75c2e214db61a75173be095c380c7c7488f1 Issue-ID: POLICY-1902 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'feature-active-standby-management/src/main/java')
-rw-r--r--feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/ActiveStandbyFeature.java18
-rw-r--r--feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpsElectionHandler.java158
2 files changed, 88 insertions, 88 deletions
diff --git a/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/ActiveStandbyFeature.java b/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/ActiveStandbyFeature.java
index c34f9ace..6101073a 100644
--- a/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/ActiveStandbyFeature.java
+++ b/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/ActiveStandbyFeature.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@ import javax.persistence.Persistence;
import org.onap.policy.drools.core.PolicySessionFeatureApi;
import org.onap.policy.drools.features.PolicyEngineFeatureApi;
-import org.onap.policy.drools.statemanagement.StateManagementFeatureAPI;
+import org.onap.policy.drools.statemanagement.StateManagementFeatureApi;
import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.drools.utils.PropertyUtil;
import org.slf4j.Logger;
@@ -57,7 +57,7 @@ public class ActiveStandbyFeature implements ActiveStandbyFeatureApi,
private static Object myPdpSync = new Object();
private static DroolsPdpsElectionHandler electionHandler;
- private StateManagementFeatureAPI stateManagementFeature;
+ private StateManagementFeatureApi stateManagementFeature;
public static final int SEQ_NUM = 1;
@@ -82,7 +82,7 @@ public class ActiveStandbyFeature implements ActiveStandbyFeatureApi,
// This must come first since it initializes myPdp
initializePersistence(configDir);
- for (StateManagementFeatureAPI feature : StateManagementFeatureAPI.impl.getList()) {
+ for (StateManagementFeatureApi feature : StateManagementFeatureApi.impl.getList()) {
if (feature.getResourceName().equals(myPdp.getPdpId())) {
if (logger.isDebugEnabled()) {
logger.debug("ActiveStandbyFeature.globalInit: Found StateManagementFeature"
@@ -95,11 +95,11 @@ public class ActiveStandbyFeature implements ActiveStandbyFeatureApi,
if (stateManagementFeature == null) {
if (logger.isDebugEnabled()) {
logger.debug("ActiveStandbyFeature failed to initialize. "
- + "Unable to get instance of StateManagementFeatureAPI "
+ + "Unable to get instance of StateManagementFeatureApi "
+ "with resourceID: {}", myPdp.getPdpId());
}
logger.error("ActiveStandbyFeature failed to initialize. "
- + "Unable to get instance of StateManagementFeatureAPI "
+ + "Unable to get instance of StateManagementFeatureApi "
+ "with resourceID: {}", myPdp.getPdpId());
//
// Cannot add observer since stateManagementFeature is null
@@ -137,7 +137,7 @@ public class ActiveStandbyFeature implements ActiveStandbyFeatureApi,
private static void initializePersistence(String configDir) {
//Get the Active Standby properties
try {
- Properties activeStandbyProperties =
+ Properties activeStandbyProperties =
PropertyUtil.getProperties(configDir + "/feature-active-standby-management.properties");
ActiveStandbyProperties.initProperties(activeStandbyProperties);
logger.info("initializePersistence: ActiveStandbyProperties success");
@@ -188,7 +188,7 @@ public class ActiveStandbyFeature implements ActiveStandbyFeatureApi,
* Moved code to instantiate a JpaDroolsPdpsConnector object from main() to
* this method, so it can also be accessed from StandbyStateChangeNotifier
* class.
- *
+ *
* @param pu string
* @return connector object
*/
diff --git a/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpsElectionHandler.java b/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpsElectionHandler.java
index fddf0246..85a0e3ab 100644
--- a/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpsElectionHandler.java
+++ b/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpsElectionHandler.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* feature-active-standby-management
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,12 +28,12 @@ import java.util.Timer;
import java.util.TimerTask;
import org.onap.policy.common.im.StateManagement;
-import org.onap.policy.drools.statemanagement.StateManagementFeatureAPI;
+import org.onap.policy.drools.statemanagement.StateManagementFeatureApi;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
- // get an instance of logger
+ // get an instance of logger
private static final Logger logger = LoggerFactory.getLogger(DroolsPdpsElectionHandler.class);
private DroolsPdpsConnector pdpsConnector;
private Object checkWaitTimerLock = new Object();
@@ -68,14 +68,14 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
*/
private Boolean allSeemsWell = null;
- private StateManagementFeatureAPI stateManagementFeature;
+ private StateManagementFeatureApi stateManagementFeature;
private static boolean isUnitTesting = false;
private static boolean isStalled = false;
/**
* Constructor.
- *
+ *
* @param pdps connectors
* @param myPdp pdp
*/
@@ -115,18 +115,18 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
final long nowMs = now.getTime();
// Create the timer which will update the updateDate in DroolsPdpEntity table.
- // This is the heartbeat
+ // This is the heartbeat
updateWorker = new Timer();
// Schedule the TimerUpdateClass to run at 100 ms and run at pdpCheckInterval ms thereafter
- // NOTE: The first run of the TimerUpdateClass results in myPdp being added to the
+ // NOTE: The first run of the TimerUpdateClass results in myPdp being added to the
// drools droolsPdpEntity table.
updateWorker.scheduleAtFixedRate(new TimerUpdateClass(), 100, pdpCheckInterval);
// Create the timer which will run the election algorithm
waitTimer = new Timer();
- // Schedule it to start in startMs ms
+ // Schedule it to start in startMs ms
// (so it will run after the updateWorker and run at pdpUpdateInterval ms thereafter
long startMs = getDWaiterStartMs();
designationWaiter = new DesignationWaiter();
@@ -135,7 +135,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
//Get the StateManagementFeature instance
- for (StateManagementFeatureAPI feature : StateManagementFeatureAPI.impl.getList()) {
+ for (StateManagementFeatureApi feature : StateManagementFeatureApi.impl.getList()) {
if (feature.getResourceName().equals(myPdp.getPdpId())) {
if (logger.isDebugEnabled()) {
logger.debug("DroolsPdpsElectionHandler: Found StateManagementFeature"
@@ -147,7 +147,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
}
if (stateManagementFeature == null) {
logger.error("DroolsPdpsElectionHandler failed to initialize. "
- + "Unable to get instance of StateManagementFeatureAPI "
+ + "Unable to get instance of StateManagementFeatureApi "
+ "with resourceID: {}", myPdp.getPdpId());
}
}
@@ -155,7 +155,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
public static void setIsUnitTesting(boolean val) {
isUnitTesting = val;
}
-
+
public static void setIsStalled(boolean val) {
isStalled = val;
}
@@ -164,7 +164,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
* When the JpaDroolsPdpsConnector.standDown() method is invoked, it needs
* access to myPdp, so it can keep its designation status in sync with the
* DB.
- *
+ *
* @param designated is designated value
*/
public static void setMyPdpDesignated(boolean designated) {
@@ -175,7 +175,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
}
private class DesignationWaiter extends TimerTask {
- // get an instance of logger
+ // get an instance of logger
private final Logger logger = LoggerFactory.getLogger(DesignationWaiter.class);
@Override
@@ -188,7 +188,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
//This is for testing the checkWaitTimer
if (isUnitTesting && isStalled) {
if (logger.isDebugEnabled()) {
- logger.debug("DesignatedWaiter.run: isUnitTesting = {} isStalled = {}",
+ logger.debug("DesignatedWaiter.run: isUnitTesting = {} isStalled = {}",
isUnitTesting, isStalled);
}
return;
@@ -245,10 +245,10 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
/*
* There are 4 combinations of isDesignated and isCurrent. We will examine each one in-turn
* and evaluate the each pdp in the list of pdps against each combination.
- *
+ *
* This is the first combination of isDesignated and isCurrent
*/
- if (pdp.isDesignated() && isCurrent) {
+ if (pdp.isDesignated() && isCurrent) {
//It is current, but it could have a standbystatus=coldstandby / hotstandby
//If so, we need to stand it down and demote it
if (!standbyStatus.equals(StateManagement.PROVIDING_SERVICE)) {
@@ -260,22 +260,22 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
}
// So, we must demote it
try {
- //Keep the order like this. StateManagement is last since it
+ //Keep the order like this. StateManagement is last since it
//triggers controller shutdown
//This will change isDesignated and it can enter another if(combination) below
- pdpsConnector.standDownPdp(pdp.getPdpId());
+ pdpsConnector.standDownPdp(pdp.getPdpId());
myPdp.setDesignated(false);
isDesignated = false;
- if (!(standbyStatus.equals(StateManagement.HOT_STANDBY)
+ if (!(standbyStatus.equals(StateManagement.HOT_STANDBY)
|| standbyStatus.equals(StateManagement.COLD_STANDBY))) {
/*
* Only demote it if it appears it has not already been demoted. Don't worry
- * about synching with the topic endpoint states. That is done by the
+ * about synching with the topic endpoint states. That is done by the
* refreshStateAudit
*/
stateManagementFeature.demote();
}
- //update the standbystatus to check in a later
+ //update the standbystatus to check in a later
//combination of isDesignated and isCurrent
standbyStatus = stateManagementFeature.getStandbyStatus(pdp.getPdpId());
} catch (Exception e) {
@@ -289,7 +289,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
logger.debug("\n\nDesignatedWaiter.run: myPdp {} is current and designated, "
+ "but standbystatus is not providingservice. "
+ " Cannot execute stateManagement.demote() "
- + "since it it is not myPdp\n\n",
+ + "since it it is not myPdp\n\n",
myPdp.getPdpId());
}
}
@@ -299,7 +299,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
if (logger.isDebugEnabled()) {
logger.debug("DesignatedWaiter.run: PDP= {} is designated, "
+ "current and {} Noting PDP as "
- + "designated, standbyStatus= {}",
+ + "designated, standbyStatus= {}",
pdp.getPdpId(), standbyStatus, standbyStatus);
}
listOfDesignated.add(pdp);
@@ -311,8 +311,8 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
/*
* The second combination of isDesignated and isCurrent
- *
- * PDP is designated but not current; it has failed.
+ *
+ * PDP is designated but not current; it has failed.
* So we stand it down (it doesn't matter what
* its standbyStatus is). None of these go on the list.
*/
@@ -320,14 +320,14 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
if (logger.isDebugEnabled()) {
logger.debug("INFO: DesignatedWaiter.run: PDP= {} is currently "
+ "designated but is not current; "
- + "it has failed. Standing down. standbyStatus= {}",
+ + "it has failed. Standing down. standbyStatus= {}",
pdp.getPdpId(), standbyStatus);
}
/*
* Changes designated to 0 but it is still potentially providing service
* Will affect isDesignated, so, it can enter an if(combination) below
*/
- pdpsConnector.standDownPdp(pdp.getPdpId());
+ pdpsConnector.standDownPdp(pdp.getPdpId());
//need to change standbystatus to coldstandby
if (pdp.getPdpId().equals(myPdp.getPdpId())) {
@@ -367,13 +367,13 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
}
continue; //we are not going to do anything else with this pdp
- }
+ }
/*
* The third combination of isDesignated and isCurrent
* /*
- * If a PDP is not currently designated but is providing service
- * (erroneous, but recoverable) or hot standby
+ * If a PDP is not currently designated but is providing service
+ * (erroneous, but recoverable) or hot standby
* we can add it to the list of possible designated if all the designated have failed
*/
if (!pdp.isDesignated() && isCurrent) {
@@ -390,16 +390,16 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
//demote it
if (logger.isDebugEnabled()) {
logger.debug("DesignatedWaiter.run: PDP {} going to "
- + "setDesignated = false and calling stateManagement.demote",
+ + "setDesignated = false and calling stateManagement.demote",
pdp.getPdpId());
}
try {
- //Keep the order like this.
+ //Keep the order like this.
//StateManagement is last since it triggers controller shutdown
pdpsConnector.setDesignated(myPdp, false);
myPdp.setDesignated(false);
isDesignated = false;
- //This is definitely not a redundant call.
+ //This is definitely not a redundant call.
//It is attempting to correct a problem
stateManagementFeature.demote();
//recheck the standbystatus
@@ -417,7 +417,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
if (logger.isDebugEnabled()) {
logger.debug("INFO: DesignatedWaiter.run: PDP= {}"
+ " is not designated but is {} and designated PDP "
- + "has failed. standbyStatus= {}", pdp.getPdpId(),
+ + "has failed. standbyStatus= {}", pdp.getPdpId(),
standbyStatus, standbyStatus);
}
listOfDesignated.add(pdp);
@@ -427,26 +427,26 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
/*
* The fourth combination of isDesignated and isCurrent
- *
+ *
* We are not going to put any of these on the list since it appears they have failed.
- *
+ *
*/
if (!pdp.isDesignated() && !isCurrent) {
if (logger.isDebugEnabled()) {
logger.debug("INFO: DesignatedWaiter.run: PDP= {} "
+ "designated= {}, current= {}, "
+ "designatedPdpHasFailed= {}, "
- + "standbyStatus= {}",pdp.getPdpId(),
+ + "standbyStatus= {}",pdp.getPdpId(),
pdp.isDesignated(), isCurrent, designatedPdpHasFailed, standbyStatus);
}
if (!standbyStatus.equals(StateManagement.COLD_STANDBY)) {
//stand it down
//disableFail it
- pdpsConnector.standDownPdp(pdp.getPdpId());
+ pdpsConnector.standDownPdp(pdp.getPdpId());
if (pdp.getPdpId().equals(myPdp.getPdpId())) {
/*
- * I don't actually know how this condition could happen,
+ * I don't actually know how this condition could happen,
* but if it did, we would want
* to declare it failed.
*/
@@ -456,7 +456,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
}
// So, we must disableFail it
try {
- //Keep the order like this.
+ //Keep the order like this.
//StateManagement is last since it triggers controller shutdown
pdpsConnector.setDesignated(myPdp, false);
myPdp.setDesignated(false);
@@ -464,22 +464,22 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
stateManagementFeature.disableFailed();
} catch (Exception e) {
logger.error("DesignatedWaiter.run: myPdp: {} Caught Exception attempting to "
- + "disableFail myPdp {}, message= {}",
+ + "disableFail myPdp {}, message= {}",
myPdp.getPdpId(), myPdp.getPdpId(), e);
}
} else { //it is remote
if (logger.isDebugEnabled()) {
logger.debug("\n\nDesignatedWaiter.run: myPdp {} is !current and !designated, "
- + " Executing stateManagement.disableFailed({})\n\n",
+ + " Executing stateManagement.disableFailed({})\n\n",
myPdp.getPdpId(), pdp.getPdpId());
}
// We already called standdown(pdp) which will change designated to false
- // Now we need to disableFail it to get its states in sync.
+ // Now we need to disableFail it to get its states in sync.
// StandbyStatus = coldstandby
try {
stateManagementFeature.disableFailed(pdp.getPdpId());
} catch (Exception e) {
- logger.error("DesignatedWaiter.run: for PDP {}"
+ logger.error("DesignatedWaiter.run: for PDP {}"
+ " Caught Exception attempting to disableFail({})"
+ ", message=", pdp.getPdpId(), pdp.getPdpId(), e);
}
@@ -493,10 +493,10 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
/*
* We have checked the four combinations of isDesignated and isCurrent. Where appropriate,
* we added the PDPs to the potential list of designated pdps
- *
+ *
* We need to give priority to pdps on the same site that is currently being used
* First, however, we must sanitize the list of designated to make sure their are
- * only designated members or non-designated members. There should not be both in
+ * only designated members or non-designated members. There should not be both in
* the list. Because there are real time delays, it is possible that both types could
* be on the list.
*/
@@ -504,7 +504,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
listOfDesignated = santizeDesignatedList(listOfDesignated);
/*
- * We need to figure out the last pdp that was the primary so we can get the last site
+ * We need to figure out the last pdp that was the primary so we can get the last site
* name and the last session numbers. We need to create a "dummy" droolspdp since
* it will be used in later comparisons and cannot be null.
*/
@@ -521,8 +521,8 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
* occurs when there is a race condition with multiple nodes coming up at the same time. If that is
* the case we must determine which one is the one that should be designated and which one should
* be demoted.
- *
- * It is possible to have 0, 1, 2 or more but not all, or all designated.
+ *
+ * It is possible to have 0, 1, 2 or more but not all, or all designated.
* If we have one designated and current, we chose it and are done
* If we have 2 or more, but not all, we must determine which one is in the same site as
* the previously designated pdp.
@@ -542,7 +542,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
waitTimerLastRunDate = new Date();
if (logger.isDebugEnabled()) {
- logger.debug("DesignatedWaiter.run (designatedPdp == null) waitTimerLastRunDate = {}",
+ logger.debug("DesignatedWaiter.run (designatedPdp == null) waitTimerLastRunDate = {}",
waitTimerLastRunDate);
}
myPdp.setUpdatedDate(waitTimerLastRunDate);
@@ -599,7 +599,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
myPdp.getPdpId(), e1);
}
- }
+ }
waitTimerLastRunDate = new Date();
if (logger.isDebugEnabled()) {
logger.debug("DesignatedWaiter.run (designatedPdp.getPdpId().equals(myPdp.getPdpId())) "
@@ -635,7 +635,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
/**
* Sanitize designated list.
- *
+ *
* @param listOfDesignated list of designated pdps
* @return list of drools pdps
*/
@@ -646,7 +646,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
List<DroolsPdp> listForRemoval = new ArrayList<>();
for (DroolsPdp pdp : listOfDesignated) {
if (logger.isDebugEnabled()) {
- logger.debug("DesignatedWaiter.run sanitizing: pdp = {}"
+ logger.debug("DesignatedWaiter.run sanitizing: pdp = {}"
+ " isDesignated = {}",pdp.getPdpId(), pdp.isDesignated());
}
if (pdp.isDesignated()) {
@@ -665,7 +665,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
/**
* Compute most recent primary.
- *
+ *
* @param pdps collection of pdps
* @param listOfDesignated list of designated pdps
* @return drools pdp object
@@ -689,14 +689,14 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
//Only one or none is designated or hot standby. Choose the latest designated date
for (DroolsPdp pdp : pdps) {
if (logger.isDebugEnabled()) {
- logger.debug("DesignatedWaiter.run pdp = {}"
- + " pdp.getDesignatedDate() = {}",
+ logger.debug("DesignatedWaiter.run pdp = {}"
+ + " pdp.getDesignatedDate() = {}",
pdp.getPdpId(), pdp.getDesignatedDate());
}
if (pdp.getDesignatedDate().compareTo(mostRecentPrimary.getDesignatedDate()) > 0) {
mostRecentPrimary = pdp;
if (logger.isDebugEnabled()) {
- logger.debug("DesignatedWaiter.run mostRecentPrimary = {}",
+ logger.debug("DesignatedWaiter.run mostRecentPrimary = {}",
mostRecentPrimary.getPdpId());
}
}
@@ -732,14 +732,14 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
if (logger.isDebugEnabled()) {
logger.debug("DesignatedWainter.run: Some but not all are designated or hot standby. ");
}
- //Some but not all are designated or hot standby.
+ //Some but not all are designated or hot standby.
if (containsDesignated) {
if (logger.isDebugEnabled()) {
logger.debug("DesignatedWainter.run: containsDesignated = {}", containsDesignated);
}
/*
* The list only contains designated. This is a problem. It is most likely a race
- * condition that resulted in two thinking they should be designated. Choose the
+ * condition that resulted in two thinking they should be designated. Choose the
* site with the latest designated date for the pdp not included on the designated list.
* This should be the site that had the last designation before this race condition
* occurred.
@@ -775,7 +775,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
/**
* Compue designated pdp.
- *
+ *
* @param listOfDesignated list of designated pdps
* @param mostRecentPrimary most recent primary pdpd
* @return drools pdp object
@@ -785,7 +785,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
DroolsPdp lowestPriorityPdp = null;
if (listOfDesignated.size() > 1) {
if (logger.isDebugEnabled()) {
- logger.debug("DesignatedWaiter.run: myPdp: {} listOfDesignated.size(): {}", myPdp.getPdpId(),
+ logger.debug("DesignatedWaiter.run: myPdp: {} listOfDesignated.size(): {}", myPdp.getPdpId(),
listOfDesignated.size());
}
DroolsPdp rejectedPdp = null;
@@ -805,7 +805,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
}
if (pdp.comparePriority(lowestPrioritySameSite) < 0) {
if (logger.isDebugEnabled()) {
- logger.debug("\nDesignatedWaiter.run: myPdp {} listOfDesignated pdp ID: {}"
+ logger.debug("\nDesignatedWaiter.run: myPdp {} listOfDesignated pdp ID: {}"
+ " has lower priority than pdp ID: {}",myPdp.getPdpId(), pdp.getPdpId(),
lowestPrioritySameSite.getPdpId());
}
@@ -815,7 +815,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
} else {
//we need to reject pdp and keep lowestPrioritySameSite
if (logger.isDebugEnabled()) {
- logger.debug("\nDesignatedWaiter.run: myPdp {} listOfDesignated pdp ID: {} "
+ logger.debug("\nDesignatedWaiter.run: myPdp {} listOfDesignated pdp ID: {} "
+ " has higher priority than pdp ID: {}", myPdp.getPdpId(),pdp.getPdpId(),
lowestPrioritySameSite.getPdpId());
}
@@ -836,7 +836,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
}
if (pdp.comparePriority(lowestPriorityDifferentSite) < 0) {
if (logger.isDebugEnabled()) {
- logger.debug("\nDesignatedWaiter.run: myPdp {} listOfDesignated pdp ID: {}"
+ logger.debug("\nDesignatedWaiter.run: myPdp {} listOfDesignated pdp ID: {}"
+ " has lower priority than pdp ID: {}", myPdp.getPdpId(), pdp.getPdpId(),
lowestPriorityDifferentSite.getPdpId());
}
@@ -846,7 +846,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
} else {
//we need to reject pdp and keep lowestPriorityDifferentSite
if (logger.isDebugEnabled()) {
- logger.debug("\nDesignatedWaiter.run: myPdp {} listOfDesignated pdp ID: {}"
+ logger.debug("\nDesignatedWaiter.run: myPdp {} listOfDesignated pdp ID: {}"
+ " has higher priority than pdp ID: {}", myPdp.getPdpId(), pdp.getPdpId(),
lowestPriorityDifferentSite.getPdpId());
}
@@ -858,8 +858,8 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
// for demoting itself
if (rejectedPdp != null && nullSafeEquals(rejectedPdp.getPdpId(),myPdp.getPdpId())) {
if (logger.isDebugEnabled()) {
- logger.debug("\n\nDesignatedWaiter.run: myPdp: {} listOfDesignated myPdp ID: {}"
- + " is NOT the lowest priority. Executing stateManagement.demote()\n\n",
+ logger.debug("\n\nDesignatedWaiter.run: myPdp: {} listOfDesignated myPdp ID: {}"
+ + " is NOT the lowest priority. Executing stateManagement.demote()\n\n",
myPdp.getPdpId(),
myPdp.getPdpId());
}
@@ -871,7 +871,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
pdpsConnector.setDesignated(myPdp, false);
isDesignated = false;
String standbyStatus = stateManagementFeature.getStandbyStatus();
- if (!(standbyStatus.equals(StateManagement.HOT_STANDBY)
+ if (!(standbyStatus.equals(StateManagement.HOT_STANDBY)
|| standbyStatus.equals(StateManagement.COLD_STANDBY))) {
/*
* Only call demote if it is not already in the right state. Don't worry about
@@ -885,7 +885,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
pdpsConnector.setDesignated(myPdp, false);
isDesignated = false;
logger.error("DesignatedWaiter.run: myPdp: {} Caught Exception attempting to "
- + "demote myPdp {} myPdp.getPdpId(), message= {}", myPdp.getPdpId(),
+ + "demote myPdp {} myPdp.getPdpId(), message= {}", myPdp.getPdpId(),
e);
}
}
@@ -898,7 +898,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
//now we have a valid value for lowestPriorityPdp
if (logger.isDebugEnabled()) {
logger.debug("\n\nDesignatedWaiter.run: myPdp: {} listOfDesignated "
- + "found the LOWEST priority pdp ID: {} "
+ + "found the LOWEST priority pdp ID: {} "
+ " It is now the designatedPpd from the perspective of myPdp ID: {} \n\n",
myPdp.getPdpId(), lowestPriorityPdp.getPdpId(), myPdp);
}
@@ -937,7 +937,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
}
}
}
-
+
@Override
public void checkThreadStatus() {
checkWaitTimer();
@@ -953,24 +953,24 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
long nowMs = now.getTime();
long waitTimerMs = waitTimerLastRunDate.getTime();
- //give it 10 times leeway
+ //give it 10 times leeway
if ((nowMs - waitTimerMs) > 10 * pdpUpdateInterval) {
if (allSeemsWell == null || allSeemsWell) {
allSeemsWell = false;
if (logger.isDebugEnabled()) {
logger.debug("checkWaitTimer: calling allSeemsWell with ALLNOTWELL param");
}
- stateManagementFeature.allSeemsWell(this.getClass().getName(),
- StateManagementFeatureAPI.ALLNOTWELL_STATE,
+ stateManagementFeature.allSeemsWell(this.getClass().getName(),
+ StateManagementFeatureApi.ALLNOTWELL_STATE,
"DesignationWaiter/ElectionHandler has STALLED");
}
- logger.error("checkWaitTimer: nowMs - waitTimerMs = {}"
+ logger.error("checkWaitTimer: nowMs - waitTimerMs = {}"
+ ", exceeds 10* pdpUpdateInterval = {}"
+ " DesignationWaiter is STALLED!", (nowMs - waitTimerMs), (10 * pdpUpdateInterval));
} else if (allSeemsWell == null || !allSeemsWell) {
allSeemsWell = true;
- stateManagementFeature.allSeemsWell(this.getClass().getName(),
- StateManagementFeatureAPI.ALLSEEMSWELL_STATE,
+ stateManagementFeature.allSeemsWell(this.getClass().getName(),
+ StateManagementFeatureApi.ALLSEEMSWELL_STATE,
"DesignationWaiter/ElectionHandler has RESUMED");
logger.info("DesignationWaiter/ElectionHandler has RESUMED");
}