aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--integrity-audit/src/main/java/org/onap/policy/common/ia/DbDAO.java4
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java56
2 files changed, 43 insertions, 17 deletions
diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDAO.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDAO.java
index e1412094..db633400 100644
--- a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDAO.java
+++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDAO.java
@@ -56,7 +56,6 @@ public class DbDAO {
private String dbDriver;
private String dbUrl;
private String dbUser;
- private String dbPwd;
private String siteName;
private String nodeType;
private Properties properties=null;
@@ -106,7 +105,6 @@ public class DbDAO {
this.dbDriver = properties.getProperty(IntegrityAuditProperties.DB_DRIVER).trim();
this.dbUrl = properties.getProperty(IntegrityAuditProperties.DB_URL).trim();
this.dbUser = properties.getProperty(IntegrityAuditProperties.DB_USER).trim();
- this.dbPwd = properties.getProperty(IntegrityAuditProperties.DB_PWD).trim();
this.siteName = properties.getProperty(IntegrityAuditProperties.SITE_NAME).trim();
this.nodeType = properties.getProperty(IntegrityAuditProperties.NODE_TYPE).trim();
this.properties = properties;
@@ -423,7 +421,7 @@ public class DbDAO {
iae.setNodeType(this.nodeType);
iae.setLastUpdated(new Date());
iae.setJdbcDriver(this.dbDriver);
- iae.setJdbcPassword(this.dbPwd);
+ iae.setJdbcPassword(properties.getProperty(IntegrityAuditProperties.DB_PWD).trim());
iae.setJdbcUrl(dbUrl);
iae.setJdbcUser(dbUser);
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java
index cf78b775..637a3042 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java
@@ -129,11 +129,15 @@ public class StateManagement extends Observable {
}
em.persist(sm);
synchronized(FLUSHLOCK){
- et.commit();
+ if(et.isActive()){
+ et.commit();
+ }
}
} else {
synchronized(FLUSHLOCK){
- et.commit();
+ if(et.isActive()){
+ et.commit();
+ }
}
}
@@ -188,7 +192,9 @@ public class StateManagement extends Observable {
em.persist(sm);
synchronized(FLUSHLOCK){
- et.commit();
+ if(et.isActive()){
+ et.commit();
+ }
}
setChanged();
notifyObservers(ADMIN_STATE);
@@ -243,7 +249,9 @@ public class StateManagement extends Observable {
em.persist(sm);
synchronized(FLUSHLOCK){
- et.commit();
+ if(et.isActive()){
+ et.commit();
+ }
}
setChanged();
notifyObservers(ADMIN_STATE);
@@ -297,7 +305,9 @@ public class StateManagement extends Observable {
em.persist(sm);
synchronized(FLUSHLOCK){
- et.commit();
+ if(et.isActive()){
+ et.commit();
+ }
}
setChanged();
notifyObservers(ADMIN_STATE);
@@ -352,7 +362,9 @@ public class StateManagement extends Observable {
em.persist(sm);
synchronized(FLUSHLOCK){
- et.commit();
+ if(et.isActive()){
+ et.commit();
+ }
}
setChanged();
notifyObservers(OPERATION_STATE);
@@ -405,7 +417,9 @@ public class StateManagement extends Observable {
em.persist(sm);
synchronized(FLUSHLOCK){
- et.commit();
+ if(et.isActive()){
+ et.commit();
+ }
}
setChanged();
notifyObservers(OPERATION_STATE);
@@ -464,7 +478,9 @@ public class StateManagement extends Observable {
em.persist(sm);
synchronized(FLUSHLOCK){
- et.commit();
+ if(et.isActive()){
+ et.commit();
+ }
}
setChanged();
notifyObservers(OPERATION_STATE);
@@ -519,7 +535,9 @@ public class StateManagement extends Observable {
em.persist(sm);
synchronized(FLUSHLOCK){
- et.commit();
+ if(et.isActive()){
+ et.commit();
+ }
}
setChanged();
notifyObservers(OPERATION_STATE);
@@ -574,7 +592,9 @@ public class StateManagement extends Observable {
em.persist(sm);
synchronized(FLUSHLOCK){
- et.commit();
+ if(et.isActive()){
+ et.commit();
+ }
}
setChanged();
notifyObservers(OPERATION_STATE);
@@ -691,7 +711,9 @@ public class StateManagement extends Observable {
em.persist(sm);
synchronized(FLUSHLOCK){
- et.commit();
+ if(et.isActive()){
+ et.commit();
+ }
}
setChanged();
notifyObservers(STANDBY_STATUS);
@@ -752,7 +774,9 @@ public class StateManagement extends Observable {
em.persist(sm);
synchronized(FLUSHLOCK){
- et.commit();
+ if(et.isActive()){
+ et.commit();
+ }
}
//We don't notify observers because this is assumed to be a remote resource
@@ -984,7 +1008,9 @@ public String getOpState()
logger.error("getStandbyStatus: resourceName ={} not found in statemanagemententity table", otherResourceName);
}
synchronized(FLUSHLOCK){
- et.commit();
+ if(et.isActive()){
+ et.commit();
+ }
}
} catch (Exception e) {
logger.error("getStandbyStatus: Caught Exception attempting to get statemanagemententity record, message='{}'", e.getMessage(), e);
@@ -1036,7 +1062,9 @@ public String getOpState()
em.remove(stateManagementEntity);
}
synchronized(FLUSHLOCK){
- et.commit();
+ if(et.isActive()){
+ et.commit();
+ }
}
}catch(Exception ex){
logger.error("StateManagement.deleteAllStateManagementEntities() caught Exception: ", ex);