logger.error("ActiveStandbyFeature failed to initialize. "
+ "Unable to get instance of StateManagementFeatureAPI "
+ "with resourceID: {}", myPdp.getPdpId());
+ //
+ // Cannot add observer since stateManagementFeature is null
+ //
+ return;
}
myPdp = new DroolsPdpImpl(resourceName,false,4,new Date());
}
- if(myPdp != null){
- String site_name = ActiveStandbyProperties.getProperty(ActiveStandbyProperties.SITE_NAME);
- if (site_name == null) {
- site_name = "";
- }else{
- site_name = site_name.trim();
- }
- myPdp.setSiteName(site_name);
+ String site_name = ActiveStandbyProperties.getProperty(ActiveStandbyProperties.SITE_NAME);
+ if (site_name == null) {
+ site_name = "";
+ }else{
+ site_name = site_name.trim();
}
+ myPdp.setSiteName(site_name);
if(electionHandler == null){
electionHandler = new DroolsPdpsElectionHandler(conn,myPdp);
}
logger.error
("DesignatedWaiter.run: myPdp: {} "
+ "Caught Exception attempting to demote myPdp,"
- + "message= {}", myPdp.getPdpId(), e.getMessage());
+ + "message= {}", myPdp.getPdpId(), e);
}
}else{
// Don't demote a remote PDP that is current. It should catch itself
logger.error
("DesignatedWaiter.run: myPdp: {} Caught Exception "
+ "attempting to disableFail myPdp {}, message= {}",
- myPdp.getPdpId(), myPdp.getPdpId(), e.getMessage());
+ myPdp.getPdpId(), myPdp.getPdpId(), e);
}
} else { //it is a remote PDP that is failed
if(logger.isDebugEnabled()){
logger.error
("DesignatedWaiter.run: for PDP {} Caught Exception attempting to "
+ "disableFail({}), message= {}",
- pdp.getPdpId(), pdp.getPdpId(), e.getMessage());
+ pdp.getPdpId(), pdp.getPdpId(), e);
}
}
logger.error
("DesignatedWaiter.run: myPdp: {} Caught Exception "
+ "attempting to demote myPdp {}, message = {}", myPdp.getPdpId(),
- myPdp.getPdpId(), e.getMessage());
+ myPdp.getPdpId(), e);
}
}
logger.error
("DesignatedWaiter.run: myPdp: {} Caught Exception attempting to "
+ "disableFail myPdp {}, message= {}",
- myPdp.getPdpId(), myPdp.getPdpId(), e.getMessage());
+ myPdp.getPdpId(), myPdp.getPdpId(), e);
}
}else{//it is remote
if(logger.isDebugEnabled()){
logger.error
("DesignatedWaiter.run: for PDP {}"
+ " Caught Exception attempting to disableFail({})"
- + ", message=", pdp.getPdpId(), pdp.getPdpId(), e.getMessage());
+ + ", message=", pdp.getPdpId(), pdp.getPdpId(), e);
}
}
}
} catch (Exception e) {
logger.error
("ERROR: DesignatedWaiter.run: Caught Exception attempting to promote PDP={}"
- + ", message=", myPdp.getPdpId(), e.getMessage());
+ + ", message=", myPdp.getPdpId(), e);
myPdp.setDesignated(false);
pdpsConnector.setDesignated(myPdp,false);
isDesignated = false;
logger.error
("ERROR: DesignatedWaiter.run: Caught StandbyStatusException "
+ "attempting to promote then demote PDP={}, message=",
- myPdp.getPdpId(), e1.getMessage());
+ myPdp.getPdpId(), e1);
}
}
logger.error
("DesignatedWaiter.run: myPdp: {} Caught Exception attempting to "
+ "demote myPdp {} myPdp.getPdpId(), message= {}", myPdp.getPdpId(),
- e.getMessage());
+ e);
}
}
} //end: for(DroolsPdp pdp : listOfDesignated)
private long waitInterval;
private boolean isNowActivating;
private String previousStandbyStatus;
- public static String NONE = "none";
- public static String UNSUPPORTED = "unsupported";
- public static String HOTSTANDBY_OR_COLDSTANDBY = "hotstandby_or_coldstandby";
+ public static final String NONE = "none";
+ public static final String UNSUPPORTED = "unsupported";
+ public static final String HOTSTANDBY_OR_COLDSTANDBY = "hotstandby_or_coldstandby";
public PMStandbyStateChangeNotifier(){
pdpUpdateInterval = Integer.parseInt(ActiveStandbyProperties.getProperty(ActiveStandbyProperties.PDP_UPDATE_INTERVAL));
isWaitingForActivation = false;
startTimeWaitingForActivationMs = new Date().getTime();
//delay the activate so the DesignatedWaiter can run twice - give it an extra 2 seconds
- waitInterval = 2*pdpUpdateInterval + 2000;
+ waitInterval = 2*pdpUpdateInterval + 2000L;
isNowActivating=false;
previousStandbyStatus = PMStandbyStateChangeNotifier.NONE;
}
delayActivateTimer.cancel();
}catch(Exception e){
if(logger.isDebugEnabled()){
- logger.debug("handleStateChange: PROVIDING_SERVICE no delayActivationTimer existed.");
+ logger.debug("handleStateChange: PROVIDING_SERVICE no delayActivationTimer existed.", e);
}
//If you end of here, there was no active timer
}
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.onap.policy.common.im.AdministrativeStateException;
import org.onap.policy.common.im.IntegrityMonitor;
import org.onap.policy.common.im.StandbyStatusException;
import org.onap.policy.drools.activestandby.PMStandbyStateChangeNotifier;
import org.onap.policy.drools.core.PolicySessionFeatureAPI;
import org.onap.policy.drools.statemanagement.StateManagementFeatureAPI;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/*
* All JUnits are designed to run in the local development environment