summaryrefslogtreecommitdiffstats
path: root/feature-active-standby-management/src/main/java
diff options
context:
space:
mode:
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.java4
-rw-r--r--feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpEntity.java2
-rw-r--r--feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpObject.java6
-rw-r--r--feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpsElectionHandler.java20
-rw-r--r--feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/JpaDroolsPdpsConnector.java11
5 files changed, 21 insertions, 22 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 2b75ea5e..7e853990 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
@@ -159,7 +159,7 @@ public class ActiveStandbyFeature implements ActiveStandbyFeatureApi,
synchronized (myPdpSync) {
if (myPdp == null) {
- myPdp = new DroolsPdpImpl(resourceName,false,4,MonitorTime.getInstance().getDate());
+ myPdp = new DroolsPdpImpl(resourceName, false, 4, MonitorTime.getInstance().getDate());
}
String siteName = ActiveStandbyProperties.getProperty(ActiveStandbyProperties.SITE_NAME);
if (siteName == null) {
@@ -169,7 +169,7 @@ public class ActiveStandbyFeature implements ActiveStandbyFeatureApi,
}
myPdp.setSite(siteName);
if (electionHandler == null) {
- electionHandler = new DroolsPdpsElectionHandler(conn,myPdp);
+ electionHandler = new DroolsPdpsElectionHandler(conn, myPdp);
}
}
logger.info("\n\nThis controller is a standby, waiting to be chosen as primary...\n\n");
diff --git a/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpEntity.java b/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpEntity.java
index 078b0477..29f66e90 100644
--- a/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpEntity.java
+++ b/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpEntity.java
@@ -58,7 +58,7 @@ public class DroolsPdpEntity extends DroolsPdpObject implements Serializable {
private Date updatedDate;
@Temporal(TemporalType.TIMESTAMP)
- @Column(name = "designatedDate",nullable = false)
+ @Column(name = "designatedDate", nullable = false)
private Date designatedDate;
@Column(name = "site", nullable = true, length = 50)
diff --git a/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpObject.java b/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpObject.java
index f753c0aa..fd25a6d3 100644
--- a/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpObject.java
+++ b/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpObject.java
@@ -26,7 +26,7 @@ public abstract class DroolsPdpObject implements DroolsPdp {
@Override
public boolean equals(Object other) {
if (other instanceof DroolsPdp) {
- return this.getPdpId().equals(((DroolsPdp)other).getPdpId());
+ return this.getPdpId().equals(((DroolsPdp) other).getPdpId());
} else {
return false;
}
@@ -71,13 +71,13 @@ public abstract class DroolsPdpObject implements DroolsPdp {
}
private int commonCompare(DroolsPdp other) {
- if (nullSafeCompare(this.getSite(),other.getSite()) == 0) {
+ if (nullSafeCompare(this.getSite(), other.getSite()) == 0) {
if (this.getPriority() != other.getPriority()) {
return this.getPriority() - other.getPriority();
}
return this.getPdpId().compareTo(other.getPdpId());
} else {
- return nullSafeCompare(this.getSite(),other.getSite());
+ return nullSafeCompare(this.getSite(), other.getSite());
}
}
}
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 f51e0718..acb7cd54 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
@@ -364,7 +364,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
logger.debug("INFO: DesignatedWaiter.run: PDP= {} "
+ "designated= {}, current= {}, "
+ "designatedPdpHasFailed= {}, "
- + "standbyStatus= {}",pdp.getPdpId(),
+ + "standbyStatus= {}", pdp.getPdpId(),
pdp.isDesignated(), false, designatedPdpHasFailed, standbyStatus);
pdpNotDesignatedNotCurrent(pdp, standbyStatus);
}
@@ -452,7 +452,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
} else { //it is a remote PDP that is failed
logger.debug("\n\nDesignatedWaiter.run: PDP {} is not Current. "
+ " Executing stateManagement.disableFailed(otherResourceName)\n\n",
- pdp.getPdpId() );
+ pdp.getPdpId());
// We found a PDP is designated but not current
// We already called standdown(pdp) which will change designated to false
// Now we need to disableFail it to get its states in synch. The standbyStatus
@@ -561,7 +561,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
private void designateNoPdp() {
// Just to be sure the parameters are correctly set
myPdp.setDesignated(false);
- pdpsConnector.setDesignated(myPdp,false);
+ pdpsConnector.setDesignated(myPdp, false);
isDesignated = false;
waitTimerLastRunDate = currentTime.getDate();
@@ -597,7 +597,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
logger.error("ERROR: DesignatedWaiter.run: Caught Exception attempting to promote PDP={}"
+ ", message=", myPdp.getPdpId(), e);
myPdp.setDesignated(false);
- pdpsConnector.setDesignated(myPdp,false);
+ pdpsConnector.setDesignated(myPdp, false);
isDesignated = false;
//If you can't promote it, demote it
try {
@@ -639,7 +639,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
List<DroolsPdp> listForRemoval = new ArrayList<>();
for (DroolsPdp pdp : listOfDesignated) {
logger.debug("DesignatedWaiter.run sanitizing: pdp = {}"
- + " isDesignated = {}",pdp.getPdpId(), pdp.isDesignated());
+ + " isDesignated = {}", pdp.getPdpId(), pdp.isDesignated());
if (pdp.isDesignated()) {
containsDesignated = true;
} else {
@@ -783,7 +783,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
}
// If the rejectedPdp is myPdp, we need to stand it down and demote it. Each pdp is responsible
// for demoting itself
- if (rejectedPdp != null && nullSafeEquals(rejectedPdp.getPdpId(),myPdp.getPdpId())) {
+ if (rejectedPdp != null && nullSafeEquals(rejectedPdp.getPdpId(), myPdp.getPdpId())) {
logger.debug("\n\nDesignatedWaiter.run: myPdp: {} listOfDesignated myPdp ID: {}"
+ " is NOT the lowest priority. Executing stateManagement.demote()\n\n",
myPdp.getPdpId(),
@@ -821,11 +821,11 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
return null;
} else {
if (pdp.getPdpId().equals((lowestPrioritySameSite.getPdpId()))) {
- return null;//nothing to compare
+ return null; //nothing to compare
}
if (pdp.comparePriority(lowestPrioritySameSite) < 0) {
logger.debug("\nDesignatedWaiter.run: myPdp {} listOfDesignated pdp ID: {}"
- + " has lower priority than pdp ID: {}",myPdp.getPdpId(), pdp.getPdpId(),
+ + " has lower priority than pdp ID: {}", myPdp.getPdpId(), pdp.getPdpId(),
lowestPrioritySameSite.getPdpId());
//we need to reject lowestPrioritySameSite
DroolsPdp rejectedPdp = lowestPrioritySameSite;
@@ -834,7 +834,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
} else {
//we need to reject pdp and keep lowestPrioritySameSite
logger.debug("\nDesignatedWaiter.run: myPdp {} listOfDesignated pdp ID: {} "
- + " has higher priority than pdp ID: {}", myPdp.getPdpId(),pdp.getPdpId(),
+ + " has higher priority than pdp ID: {}", myPdp.getPdpId(), pdp.getPdpId(),
lowestPrioritySameSite.getPdpId());
return pdp;
}
@@ -851,7 +851,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
return null;
}
if (pdp.getPdpId().equals((lowestPriorityDifferentSite.getPdpId()))) {
- return null;//nothing to compare
+ return null; //nothing to compare
}
if (pdp.comparePriority(lowestPriorityDifferentSite) < 0) {
logger.debug("\nDesignatedWaiter.run: myPdp {} listOfDesignated pdp ID: {}"
diff --git a/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/JpaDroolsPdpsConnector.java b/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/JpaDroolsPdpsConnector.java
index 6e456962..14ae52a0 100644
--- a/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/JpaDroolsPdpsConnector.java
+++ b/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/JpaDroolsPdpsConnector.java
@@ -24,7 +24,6 @@ import java.util.Collection;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
-
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.FlushModeType;
@@ -68,7 +67,7 @@ public class JpaDroolsPdpsConnector implements DroolsPdpsConnector {
continue;
}
//Make sure it is not a cached version
- DroolsPdp droolsPdp = (DroolsPdp)o;
+ DroolsPdp droolsPdp = (DroolsPdp) o;
em.refresh(droolsPdp);
droolsPdpsReturnList.add(droolsPdp);
if (logger.isDebugEnabled()) {
@@ -115,7 +114,7 @@ public class JpaDroolsPdpsConnector implements DroolsPdpsConnector {
.setFlushMode(FlushModeType.COMMIT).getResultList();
DroolsPdpEntity droolsPdpEntity;
if (droolsPdpsList.size() == 1 && (droolsPdpsList.get(0) instanceof DroolsPdpEntity)) {
- droolsPdpEntity = (DroolsPdpEntity)droolsPdpsList.get(0);
+ droolsPdpEntity = (DroolsPdpEntity) droolsPdpsList.get(0);
em.refresh(droolsPdpEntity); //Make sure we have current values
Date currentDate = currentTime.getDate();
long difference = currentDate.getTime() - droolsPdpEntity.getUpdatedDate().getTime();
@@ -145,7 +144,7 @@ public class JpaDroolsPdpsConnector implements DroolsPdpsConnector {
if (!droolsPdpEntity.getUpdatedDate().equals(pdp.getUpdatedDate())) {
droolsPdpEntity.setUpdatedDate(pdp.getUpdatedDate());
}
- if (!nullSafeEquals(droolsPdpEntity.getSite(),pdp.getSite())) {
+ if (!nullSafeEquals(droolsPdpEntity.getSite(), pdp.getSite())) {
droolsPdpEntity.setSite(pdp.getSite());
}
@@ -192,7 +191,7 @@ public class JpaDroolsPdpsConnector implements DroolsPdpsConnector {
if (droolsPdpsList.size() == 1 && droolsPdpsList.get(0) instanceof DroolsPdpEntity) {
logger.debug("isPdpCurrent: PDP={} designated but not current; setting designated to false",
pdp.getPdpId());
- DroolsPdpEntity droolsPdpEntity = (DroolsPdpEntity)droolsPdpsList.get(0);
+ DroolsPdpEntity droolsPdpEntity = (DroolsPdpEntity) droolsPdpsList.get(0);
droolsPdpEntity.setDesignated(false);
em.getTransaction().commit();
} else {
@@ -292,7 +291,7 @@ public class JpaDroolsPdpsConnector implements DroolsPdpsConnector {
droolsPdpEntity = (DroolsPdpEntity) droolsPdpsList.get(0);
droolsPdpEntity.setDesignated(false);
em.persist(droolsPdpEntity);
- logger.debug("standDownPdp: PDP={} persisted as non-designated.", pdpId );
+ logger.debug("standDownPdp: PDP={} persisted as non-designated.", pdpId);
} else {
logger.error("standDownPdp: Missing record in droolspdpentity for pdpId={}"
+ "; cannot stand down PDP", pdpId);