* May be modified by JUnit tests.
*/
private static final long AUDIT_THREAD_SLEEP_INTERVAL_MS = 5000L;
+
+ /*
+ * String constants.
+ */
+ private static final String AUDIT_THREAD_MESSAGE = "AuditThread.run: resourceName=";
+ private static final String ENTITY_INDEX_MESSAGE = ", entityIndex=";
+ private static final String LAST_UPDATED_MESSAGE = ", lastUpdated=";
+ private static final String PERSISTENCE_MESSAGE = ", persistenceUnit=";
/*
* DB access class.
*/
private IntegrityAudit integrityAudit;
+ /*
+ * Used to create a list that is sorted lexicographically by resourceName.
+ */
+ Comparator<IntegrityAuditEntity> comparator = new Comparator<IntegrityAuditEntity>() {
+ @Override
+ public int compare(final IntegrityAuditEntity r1, final IntegrityAuditEntity r2) {
+ return r1.getResourceName().compareTo(r2.getResourceName());
+ }
+ };
+
/**
* AuditThread constructor.
*
}
AuditorTime.getInstance().sleep(integrityAuditPeriodSeconds * 1000L);
if (logger.isDebugEnabled()) {
- logger.debug("AuditThread.run: resourceName=" + this.resourceName + " awaking from "
+ logger.debug(AUDIT_THREAD_MESSAGE + this.resourceName + " awaking from "
+ integrityAuditPeriodSeconds + "s sleep");
}
} else {
if (logger.isDebugEnabled()) {
- logger.debug("AuditThread.run: resourceName=" + this.resourceName + ": Sleeping "
+ logger.debug(AUDIT_THREAD_MESSAGE + this.resourceName + ": Sleeping "
+ AuditThread.AUDIT_THREAD_SLEEP_INTERVAL_MS + "ms");
}
AuditorTime.getInstance().sleep(AuditThread.AUDIT_THREAD_SLEEP_INTERVAL_MS);
if (logger.isDebugEnabled()) {
- logger.debug("AuditThread.run: resourceName=" + this.resourceName + ": Awaking from "
+ logger.debug(AUDIT_THREAD_MESSAGE + this.resourceName + ": Awaking from "
+ AuditThread.AUDIT_THREAD_SLEEP_INTERVAL_MS + "ms sleep");
}
return false;
}
- /*
- * Used to create a list that is sorted lexicographically by resourceName.
- */
- Comparator<IntegrityAuditEntity> comparator = new Comparator<IntegrityAuditEntity>() {
- @Override
- public int compare(final IntegrityAuditEntity r1, final IntegrityAuditEntity r2) {
- return r1.getResourceName().compareTo(r2.getResourceName());
- }
- };
-
/**
* getDesignationCandidate() Using round robin algorithm, gets next candidate to be designated.
* Assumes list is sorted lexicographically by resourceName.
if (integrityAuditEntity.isDesignated()) {
if (logger.isDebugEnabled()) {
logger.debug("getDesignationCandidate: Currently designated entity resourceName="
- + integrityAuditEntity.getResourceName() + ", persistenceUnit="
- + integrityAuditEntity.getPersistenceUnit() + ", lastUpdated="
- + integrityAuditEntity.getLastUpdated() + ", entityIndex=" + entityIndex);
+ + integrityAuditEntity.getResourceName() + PERSISTENCE_MESSAGE
+ + integrityAuditEntity.getPersistenceUnit() + LAST_UPDATED_MESSAGE
+ + integrityAuditEntity.getLastUpdated() + ENTITY_INDEX_MESSAGE + entityIndex);
}
designatedEntityIndex = entityIndex;
if (logger.isDebugEnabled()) {
logger.debug("getDesignationCandidate: Entity is stale; resourceName="
- + integrityAuditEntity.getResourceName() + ", persistenceUnit="
- + integrityAuditEntity.getPersistenceUnit() + ", lastUpdated="
- + integrityAuditEntity.getLastUpdated() + ", entityIndex=" + entityIndex);
+ + integrityAuditEntity.getResourceName() + PERSISTENCE_MESSAGE
+ + integrityAuditEntity.getPersistenceUnit() + LAST_UPDATED_MESSAGE
+ + integrityAuditEntity.getLastUpdated() + ENTITY_INDEX_MESSAGE + entityIndex);
}
/*
if (priorCandidateIndex == -1) {
if (logger.isDebugEnabled()) {
logger.debug("getDesignationCandidate: Prior candidate found, resourceName="
- + integrityAuditEntity.getResourceName() + ", persistenceUnit="
- + integrityAuditEntity.getPersistenceUnit() + ", lastUpdated="
- + integrityAuditEntity.getLastUpdated() + ", entityIndex=" + entityIndex);
+ + integrityAuditEntity.getResourceName() + PERSISTENCE_MESSAGE
+ + integrityAuditEntity.getPersistenceUnit() + LAST_UPDATED_MESSAGE
+ + integrityAuditEntity.getLastUpdated() + ENTITY_INDEX_MESSAGE + entityIndex);
}
priorCandidateIndex = entityIndex;
} else {
logger.debug(
"getDesignationCandidate: Prior entity current but prior candidate already "
+ "found; resourceName=" + integrityAuditEntity.getResourceName()
- + ", persistenceUnit=" + integrityAuditEntity.getPersistenceUnit()
- + ", lastUpdated=" + integrityAuditEntity.getLastUpdated()
- + ", entityIndex=" + entityIndex);
+ + PERSISTENCE_MESSAGE + integrityAuditEntity.getPersistenceUnit()
+ + LAST_UPDATED_MESSAGE + integrityAuditEntity.getLastUpdated()
+ + ENTITY_INDEX_MESSAGE + entityIndex);
}
}
} else {
if (subsequentCandidateIndex == -1) {
if (logger.isDebugEnabled()) {
logger.debug("getDesignationCandidate: Subsequent candidate found, resourceName="
- + integrityAuditEntity.getResourceName() + ", persistenceUnit="
- + integrityAuditEntity.getPersistenceUnit() + ", lastUpdated="
- + integrityAuditEntity.getLastUpdated() + ", entityIndex=" + entityIndex);
+ + integrityAuditEntity.getResourceName() + PERSISTENCE_MESSAGE
+ + integrityAuditEntity.getPersistenceUnit() + LAST_UPDATED_MESSAGE
+ + integrityAuditEntity.getLastUpdated() + ENTITY_INDEX_MESSAGE + entityIndex);
}
subsequentCandidateIndex = entityIndex;
} else {
logger.debug(
"getDesignationCandidate: Subsequent entity current but subsequent candidate "
+ "already found; resourceName="
- + integrityAuditEntity.getResourceName() + ", persistenceUnit="
- + integrityAuditEntity.getPersistenceUnit() + ", lastUpdated="
- + integrityAuditEntity.getLastUpdated() + ", entityIndex="
+ + integrityAuditEntity.getResourceName() + PERSISTENCE_MESSAGE
+ + integrityAuditEntity.getPersistenceUnit() + LAST_UPDATED_MESSAGE
+ + integrityAuditEntity.getLastUpdated() + ENTITY_INDEX_MESSAGE
+ entityIndex);
}
}
if (integrityAuditEntity.isDesignated()) {
if (logger.isDebugEnabled()) {
logger.debug("getEntityCurrentlyDesignated: Currently designated entity resourceName="
- + integrityAuditEntity.getResourceName() + ", persistenceUnit="
- + integrityAuditEntity.getPersistenceUnit() + ", lastUpdated="
+ + integrityAuditEntity.getResourceName() + PERSISTENCE_MESSAGE
+ + integrityAuditEntity.getPersistenceUnit() + LAST_UPDATED_MESSAGE
+ integrityAuditEntity.getLastUpdated());
}
entityCurrentlyDesignated = integrityAuditEntity;
if (logger.isDebugEnabled()) {
logger.debug(
"getThisEntity: For this entity, resourceName=" + integrityAuditEntity.getResourceName()
- + ", persistenceUnit=" + integrityAuditEntity.getPersistenceUnit()
- + ", lastUpdated=" + integrityAuditEntity.getLastUpdated());
+ + PERSISTENCE_MESSAGE + integrityAuditEntity.getPersistenceUnit()
+ + LAST_UPDATED_MESSAGE + integrityAuditEntity.getLastUpdated());
}
thisEntity = integrityAuditEntity;
}
if (logger.isDebugEnabled()) {
logger.debug("isStale: Entering, resourceName=" + integrityAuditEntity.getResourceName()
- + ", persistenceUnit=" + integrityAuditEntity.getPersistenceUnit() + ", lastUpdated="
+ + PERSISTENCE_MESSAGE + integrityAuditEntity.getPersistenceUnit() + LAST_UPDATED_MESSAGE
+ integrityAuditEntity.getLastUpdated());
}
logger.debug("logIntegrityAuditEntity: id=" + integrityAuditEntity.getId() + ", jdbcDriver="
+ integrityAuditEntity.getJdbcDriver() + ", jdbcPassword=" + integrityAuditEntity.getJdbcPassword()
+ ", jdbcUrl=" + integrityAuditEntity.getJdbcUrl() + ", jdbcUser=" + integrityAuditEntity.getJdbcUser()
- + ", nodeType=" + integrityAuditEntity.getNodeType() + ", persistenceUnit="
+ + ", nodeType=" + integrityAuditEntity.getNodeType() + PERSISTENCE_MESSAGE
+ integrityAuditEntity.getPersistenceUnit() + ", resourceName=" + integrityAuditEntity.getResourceName()
+ ", site=" + integrityAuditEntity.getSite() + ", createdDate=" + integrityAuditEntity.getCreatedDate()
- + ", lastUpdated=" + integrityAuditEntity.getLastUpdated() + ", designated="
+ + LAST_UPDATED_MESSAGE + integrityAuditEntity.getLastUpdated() + ", designated="
+ integrityAuditEntity.isDesignated());
}
if (logger.isDebugEnabled()) {
logger.debug("resetAuditCompleted: auditCompleted=" + auditCompleted + "; for thisEntity, resourceName="
- + thisEntity.getResourceName() + ", persistenceUnit=" + thisEntity.getPersistenceUnit()
- + ", lastUpdated=" + thisEntity.getLastUpdated());
+ + thisEntity.getResourceName() + PERSISTENCE_MESSAGE + thisEntity.getPersistenceUnit()
+ + LAST_UPDATED_MESSAGE + thisEntity.getLastUpdated());
}
long timeDifference;
* Supports designation serialization.
*/
private static final Object lock = new Object();
+
+ /*
+ * Common strings.
+ */
+ private static final String RESOURCE_MESSAGE = "Resource: ";
+ private static final String WITH_PERSISTENCE_MESSAGE = " with PersistenceUnit: ";
+ private static final String DBDAO_MESSAGE = "DbDAO: ";
+ private static final String ENCOUNTERED_MESSAGE = "ecountered a problem in execution: ";
+
+ /*
+ * DB SELECT String.
+ */
+ private static final String SELECT_STRING = "Select i from IntegrityAuditEntity i "
+ + "where i.resourceName=:rn and i.persistenceUnit=:pu";
/**
* DbDAO Constructor.
logger.debug("getIntegrityAuditEntities: Exit, iaeList=" + iaeList);
return iaeList;
} catch (Exception e) {
- String msg = "DbDAO: " + "getIntegrityAuditEntities() " + "ecountered a problem in execution: ";
+ String msg = DBDAO_MESSAGE + "getIntegrityAuditEntities() " + ENCOUNTERED_MESSAGE;
logger.error(msg, e);
throw new DbDaoTransactionException(e);
}
// if IntegrityAuditEntity entry exists for resourceName and PU, retrieve it
Query iaequery = em.createQuery(
- "Select i from IntegrityAuditEntity i where i.resourceName=:rn and i.persistenceUnit=:pu");
+ SELECT_STRING);
iaequery.setParameter("rn", this.resourceName);
iaequery.setParameter("pu", this.persistenceUnit);
iae = (IntegrityAuditEntity) iaeList.get(0);
// refresh the object from DB in case cached data was returned
em.refresh(iae);
- logger.info("Resource: " + this.resourceName + " with PersistenceUnit: " + this.persistenceUnit
+ logger.info(RESOURCE_MESSAGE + this.resourceName + WITH_PERSISTENCE_MESSAGE + this.persistenceUnit
+ " exists");
} else {
// If it does not exist, log an error
- logger.error("Attempting to setLastUpdated" + " on an entry that does not exist:" + " resource "
- + this.resourceName + " with PersistenceUnit: " + this.persistenceUnit);
+ logger.error("Attempting to setLastUpdated" + " on an entry that does not exist: resource "
+ + this.resourceName + WITH_PERSISTENCE_MESSAGE + this.persistenceUnit);
}
// close the transaction
return iae;
} catch (Exception e) {
- String msg = "DbDAO: " + "setLastUpdated() " + "ecountered a problem in execution: ";
+ String msg = DBDAO_MESSAGE + "setLastUpdated() " + ENCOUNTERED_MESSAGE;
logger.error(msg + e);
throw new DbDaoTransactionException(e);
}
return iae;
} catch (Exception e) {
- String msg = "DbDAO: " + "getIntegrityAuditEntity() " + "ecountered a problem in execution: ";
+ String msg = DBDAO_MESSAGE + "getIntegrityAuditEntity() " + ENCOUNTERED_MESSAGE;
logger.error(msg + e);
throw new DbDaoTransactionException(e);
}
// if IntegrityAuditEntity entry exists for resourceName and PU, update it. If not
// found, create a new entry
Query iaequery = em.createQuery(
- "Select i from IntegrityAuditEntity i where i.resourceName=:rn and i.persistenceUnit=:pu");
+ SELECT_STRING);
iaequery.setParameter("rn", this.resourceName);
iaequery.setParameter("pu", this.persistenceUnit);
iae = (IntegrityAuditEntity) iaeList.get(0);
// refresh the object from DB in case cached data was returned
em.refresh(iae);
- logger.info("Resource: " + this.resourceName + " with PersistenceUnit: " + this.persistenceUnit
+ logger.info(RESOURCE_MESSAGE + this.resourceName + WITH_PERSISTENCE_MESSAGE + this.persistenceUnit
+ " exists and entry be updated");
} else {
// If it does not exist, we also must add teh resourceName, persistenceUnit and
// designated values
- logger.info("Adding resource " + resourceName + " with PersistenceUnit: " + this.persistenceUnit
+ logger.info("Adding resource " + resourceName + WITH_PERSISTENCE_MESSAGE + this.persistenceUnit
+ " to IntegrityAuditEntity table");
iae = new IntegrityAuditEntity();
iae.setResourceName(this.resourceName);
et.commit();
em.close();
} catch (Exception e) {
- String msg = "DbDAO: " + "register() " + "encountered a problem in execution: ";
+ String msg = DBDAO_MESSAGE + "register() " + "encountered a problem in execution: ";
logger.error(msg + e);
throw new DbDaoTransactionException(e);
}
// if IntegrityAuditEntity entry exists for resourceName and PU, update it. If not
// found, create a new entry
Query iaequery = em.createQuery(
- "Select i from IntegrityAuditEntity i where i.resourceName=:rn and i.persistenceUnit=:pu");
+ SELECT_STRING);
iaequery.setParameter("rn", resourceName);
iaequery.setParameter("pu", persistenceUnit);
iae = (IntegrityAuditEntity) iaeList.get(0);
// refresh the object from DB in case cached data was returned
em.refresh(iae);
- logger.info("Resource: " + resourceName + " with PersistenceUnit: " + persistenceUnit
+ logger.info(RESOURCE_MESSAGE + resourceName + WITH_PERSISTENCE_MESSAGE + persistenceUnit
+ " exists and designated be updated");
iae.setDesignated(desig);
} else {
// If it does not exist, log an error
logger.error("Attempting to setDesignated(" + desig + ") on an entry that does not exist:"
- + " resource " + resourceName + " with PersistenceUnit: " + persistenceUnit);
+ + " resource " + resourceName + WITH_PERSISTENCE_MESSAGE + persistenceUnit);
}
// close the transaction
// close the EntityManager
em.close();
} catch (Exception e) {
- String msg = "DbDAO: " + "setDesignated() " + "ecountered a problem in execution: ";
+ String msg = DBDAO_MESSAGE + "setDesignated() " + ENCOUNTERED_MESSAGE;
logger.error(msg + e);
throw new DbDaoTransactionException(e);
}
// if IntegrityAuditEntity entry exists for resourceName and PU, update it. If not
// found, create a new entry
Query iaequery = em.createQuery(
- "Select i from IntegrityAuditEntity i where i.resourceName=:rn and i.persistenceUnit=:pu");
+ SELECT_STRING);
iaequery.setParameter("rn", this.resourceName);
iaequery.setParameter("pu", this.persistenceUnit);
iae = (IntegrityAuditEntity) iaeList.get(0);
// refresh the object from DB in case cached data was returned
em.refresh(iae);
- logger.info("Resource: " + this.resourceName + " with PersistenceUnit: " + this.persistenceUnit
+ logger.info(RESOURCE_MESSAGE + this.resourceName + WITH_PERSISTENCE_MESSAGE + this.persistenceUnit
+ " exists and lastUpdated be updated");
iae.setLastUpdated(AuditorTime.getInstance().getDate());
} else {
// If it does not exist, log an error
logger.error("Attempting to setLastUpdated" + " on an entry that does not exist:" + " resource "
- + this.resourceName + " with PersistenceUnit: " + this.persistenceUnit);
+ + this.resourceName + WITH_PERSISTENCE_MESSAGE + this.persistenceUnit);
}
// close the transaction
// close the EntityManager
em.close();
} catch (Exception e) {
- String msg = "DbDAO: " + "setLastUpdated() " + "ecountered a problem in execution: ";
+ String msg = DBDAO_MESSAGE + "setLastUpdated() " + ENCOUNTERED_MESSAGE;
logger.error(msg + e);
throw new DbDaoTransactionException(e);
}
try {
if (!IntegrityAudit.isUnitTesting()) {
- String msg = "DbDAO: " + "deleteAllIntegrityAuditEntities() "
+ String msg = DBDAO_MESSAGE + "deleteAllIntegrityAuditEntities() "
+ "should only be invoked during JUnit testing";
logger.error(msg);
throw new DbDaoTransactionException(msg);
return returnCode;
} catch (Exception e) {
- String msg = "DbDAO: " + "deleteAllIntegrityAuditEntities() " + "encountered a problem in execution: ";
+ String msg = DBDAO_MESSAGE + "deleteAllIntegrityAuditEntities() " + "encountered a problem in execution: ";
logger.error(msg + e);
throw new DbDaoTransactionException(e);
}
if (em != null) {
em.getTransaction().rollback();
- String msg = "DbDAO: " + "changeDesignated() " + "caught LockTimeoutException, message="
+ String msg = "DbDAO: changeDesignated() caught LockTimeoutException, message="
+ e.getMessage();
logger.error(msg + e);
throw new DbDaoTransactionException(msg, e);
} else {
- String msg = "DbDAO: " + "changeDesignated() " + "caught LockTimeoutException, message="
+ String msg = "DbDAO: changeDesignated() caught LockTimeoutException, message="
+ e.getMessage() + ". Error rolling back transaction.";
logger.error(msg + e);
throw new DbDaoTransactionException(msg, e);
if (em != null) {
em.getTransaction().rollback();
- String msg = "DbDAO: " + "changeDesignated() " + "caught Exception, message=" + e.getMessage();
+ String msg = "DbDAO: changeDesignated() caught Exception, message=" + e.getMessage();
logger.error(msg + e);
throw new DbDaoTransactionException(msg, e);
} else {
- String msg = "DbDAO: " + "changeDesignated() " + "caught LockTimeoutException, message="
+ String msg = "DbDAO: changeDesignated() caught Exception, message="
+ e.getMessage() + ". Error rolling back transaction.";
logger.error(msg + e);
throw new DbDaoTransactionException(msg, e);
// only allow one instance of IntegrityMonitor
private static IntegrityMonitor instance = null;
+ /*
+ * Common strings
+ */
+ private static final String NULL_PROPERTY_STRING = " property is null";
+ private static final String IGNORE_INVALID_PROPERTY_STRING = "Ignored invalid property: {}";
+ private static final String PROPERTY_EXCEPTION_STRING = "IntegrityMonitor Property Exception: ";
+ private static final String EXCEPTION_STRING = "IntegrityMonitor threw exception.";
+ private static final String STATE_CHECK_STRING = "IntegrityMonitor.stateCheck(): "
+ + "Failed to diableFail dependent resource = ";
+ private static final String RESOURCE_STRING = "Resource ";
+ private static final String LC_RESOURCE_STRING = "resource";
+
+ /*
+ * Query String
+ */
+ private static final String QUERY_STRING = "Select f from ForwardProgressEntity f where f.resourceName=:rn";
+
// may be changed by junit tests
private static Factory factory = new Factory();
try {
// if ForwardProgress entry exists for resourceName, update it. If
// not found, create a new entry
- Query fquery = em.createQuery("Select f from ForwardProgressEntity f where f.resourceName=:rn");
+ Query fquery = em.createQuery(QUERY_STRING);
fquery.setParameter("rn", resourceName);
@SuppressWarnings("rawtypes")
logger.debug("evaluateSanity dependencyCheckErrorMsg = {}", errorMsg);
// check op state and throw exception if disabled
if ((stateManager.getOpState() != null) && stateManager.getOpState().equals(StateManagement.DISABLED)) {
- String msg = "Resource " + resourceName + " operation state is disabled. " + errorMsg;
+ String msg = RESOURCE_STRING + resourceName + " operation state is disabled. " + errorMsg;
logger.debug("{}", msg);
throw new IntegrityMonitorException(msg);
}
// check admin state and throw exception if locked
if ((stateManager.getAdminState() != null) && stateManager.getAdminState().equals(StateManagement.LOCKED)) {
- String msg = "Resource " + resourceName + " is administratively locked";
+ String msg = RESOURCE_STRING + resourceName + " is administratively locked";
logger.debug("{}", msg);
throw new AdministrativeStateException("IntegrityMonitor Admin State Exception: " + msg);
}
// check standby state and throw exception if cold standby
if ((stateManager.getStandbyStatus() != null)
&& stateManager.getStandbyStatus().equals(StateManagement.COLD_STANDBY)) {
- String msg = "Resource " + resourceName + " is cold standby";
+ String msg = RESOURCE_STRING + resourceName + " is cold standby";
logger.debug("{}", msg);
throw new StandbyStatusException("IntegrityMonitor Standby Status Exception: " + msg);
}
try {
Query query = em.createQuery("Select p from ForwardProgressEntity p where p.resourceName=:resource");
- query.setParameter("resource", dep);
+ query.setParameter(LC_RESOURCE_STRING, dep);
@SuppressWarnings("rawtypes")
List fpList = query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
try {
// query if StateManagement entry exists for dependent resource
Query query = em.createQuery("Select p from StateManagementEntity p where p.resourceName=:resource");
- query.setParameter("resource", dep);
+ query.setParameter(LC_RESOURCE_STRING, dep);
@SuppressWarnings("rawtypes")
List smList = query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
stateManager.disableFailed(dep);
}
} catch (Exception e) {
- String msg = "IntegrityMonitor.stateCheck(): Failed to diableFail dependent resource = " + dep
+ String msg = STATE_CHECK_STRING + dep
+ "; " + e.getMessage();
logger.error("{}", msg, e);
}
} else {
if (forwardProgressEntity == null) {
- String msg = "IntegrityMonitor.stateCheck(): Failed to diableFail dependent resource = " + dep
+ String msg = STATE_CHECK_STRING + dep
+ "; " + " forwardProgressEntity == null.";
logger.error("{}", msg);
}
else {
- String msg = "IntegrityMonitor.stateCheck(): Failed to diableFail dependent resource = " + dep
+ String msg = STATE_CHECK_STRING + dep
+ "; " + " stateManagementEntity == null.";
logger.error("{}", msg);
}
EntityTransaction et = em.getTransaction();
et.begin();
try {
- Query fquery = em.createQuery("Select f from ForwardProgressEntity f where f.resourceName=:rn");
+ Query fquery = em.createQuery(QUERY_STRING);
fquery.setParameter("rn", dep);
@SuppressWarnings("rawtypes")
errorMsg = errorMsg.concat(resourceName + ": " + e.getMessage());
this.stateManager.disableDependency();
} catch (Exception ex) {
- logger.error("IntegrityMonitor threw exception.", ex);
+ logger.error(EXCEPTION_STRING, ex);
if (!errorMsg.isEmpty()) {
errorMsg = errorMsg.concat(",");
}
this.stateManager.disableDependency();
}
} catch (Exception e) {
- logger.error("IntegrityMonitor threw exception.", e);
+ logger.error(EXCEPTION_STRING, e);
if (!errorMsg.isEmpty()) {
errorMsg = errorMsg.concat(",");
}
// The refreshStateAudit will catch the case where it is disabled but
// availStatus != failed
} catch (Exception e) {
- logger.error("IntegrityMonitor threw exception.", e);
+ logger.error(EXCEPTION_STRING, e);
if (!errorMsg.isEmpty()) {
errorMsg = errorMsg.concat(",");
}
// The refreshStateAudit will catch the case where it is disabled but
// availStatus != failed
} catch (Exception e) {
- logger.error("IntegrityMonitor threw exception.", e);
+ logger.error(EXCEPTION_STRING, e);
if (!errorMsg.isEmpty()) {
errorMsg = errorMsg.concat(",");
}
synchronized (startTransactionLock) {
// check admin state and throw exception if locked
if ((stateManager.getAdminState() != null) && stateManager.getAdminState().equals(StateManagement.LOCKED)) {
- String msg = "Resource " + resourceName + " is administratively locked";
+ String msg = RESOURCE_STRING + resourceName + " is administratively locked";
throw new AdministrativeStateException("IntegrityMonitor Admin State Exception: " + msg);
}
if ((stateManager.getStandbyStatus() != null)
&& (stateManager.getStandbyStatus().equals(StateManagement.HOT_STANDBY)
|| stateManager.getStandbyStatus().equals(StateManagement.COLD_STANDBY))) {
- String msg = "Resource " + resourceName + " is standby";
+ String msg = RESOURCE_STRING + resourceName + " is standby";
throw new StandbyStatusException("IntegrityMonitor Standby Status Exception: " + msg);
}
+ "progress counter. \n{}\n", msg);
return;
} else {
- if (logger.isDebugEnabled()) {
- if (getAllSeemsWellMap() != null) {
- if (!(getAllSeemsWellMap().isEmpty())) {
- String msg = "allSeemsWellMap:";
- for (Entry<String, String> entry : allSeemsWellMap.entrySet()) {
- msg = msg.concat("\nkey = " + entry.getKey() + " msg = " + entry.getValue());
- }
- logger.debug(
- "endTransaction: allNotWellMap IS EMPTY and allSeemsWellMap is NOT EMPTY. "
- + "Advancing forward progress counter. \n{}\n",
- msg);
- }
+ if (logger.isDebugEnabled() && getAllSeemsWellMap() != null && !(getAllSeemsWellMap().isEmpty())) {
+ String msg = "allSeemsWellMap:";
+ for (Entry<String, String> entry : allSeemsWellMap.entrySet()) {
+ msg = msg.concat("\nkey = " + entry.getKey() + " msg = " + entry.getValue());
}
+ logger.debug(
+ "endTransaction: allNotWellMap IS EMPTY and allSeemsWellMap is NOT EMPTY. "
+ + "Advancing forward progress counter. \n{}\n", msg);
}
}
}
try {
// query if ForwardProgress entry exists for resourceName
- Query fquery = em.createQuery("Select f from ForwardProgressEntity f where f.resourceName=:rn");
+ Query fquery = em.createQuery(QUERY_STRING);
fquery.setParameter("rn", resourceName);
@SuppressWarnings("rawtypes")
}
}
} catch (Exception e1) {
- logger.error("IntegrityMonitor threw exception.", e1);
+ logger.error(EXCEPTION_STRING, e1);
}
logger.error("writeFpc DB table commit failed with exception: {}", e);
throw e;
private static void validateProperties(Properties prop) throws IntegrityMonitorPropertiesException {
if (prop.getProperty(IntegrityMonitorProperties.DB_DRIVER) == null) {
- String msg = IntegrityMonitorProperties.DB_DRIVER + " property is null";
+ String msg = IntegrityMonitorProperties.DB_DRIVER + NULL_PROPERTY_STRING;
logger.error("{}", msg);
- throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
+ throw new IntegrityMonitorPropertiesException(PROPERTY_EXCEPTION_STRING + msg);
}
if (prop.getProperty(IntegrityMonitorProperties.DB_URL) == null) {
- String msg = IntegrityMonitorProperties.DB_URL + " property is null";
+ String msg = IntegrityMonitorProperties.DB_URL + NULL_PROPERTY_STRING;
logger.error("{}", msg);
- throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
+ throw new IntegrityMonitorPropertiesException(PROPERTY_EXCEPTION_STRING + msg);
}
if (prop.getProperty(IntegrityMonitorProperties.DB_USER) == null) {
- String msg = IntegrityMonitorProperties.DB_USER + " property is null";
+ String msg = IntegrityMonitorProperties.DB_USER + NULL_PROPERTY_STRING;
logger.error("{}", msg);
- throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
+ throw new IntegrityMonitorPropertiesException(PROPERTY_EXCEPTION_STRING + msg);
}
if (prop.getProperty(IntegrityMonitorProperties.DB_PWD) == null) {
- String msg = IntegrityMonitorProperties.DB_PWD + " property is null";
+ String msg = IntegrityMonitorProperties.DB_PWD + NULL_PROPERTY_STRING;
logger.error("{}", msg);
- throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
+ throw new IntegrityMonitorPropertiesException(PROPERTY_EXCEPTION_STRING + msg);
}
if (prop.getProperty(IntegrityMonitorProperties.FP_MONITOR_INTERVAL) != null) {
monitorIntervalMs = toMillis(
Integer.parseInt(prop.getProperty(IntegrityMonitorProperties.FP_MONITOR_INTERVAL).trim()));
} catch (NumberFormatException e) {
- logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.FP_MONITOR_INTERVAL, e);
+ logger.warn(IGNORE_INVALID_PROPERTY_STRING, IntegrityMonitorProperties.FP_MONITOR_INTERVAL, e);
}
}
failedCounterThreshold =
Integer.parseInt(prop.getProperty(IntegrityMonitorProperties.FAILED_COUNTER_THRESHOLD).trim());
} catch (NumberFormatException e) {
- logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.FAILED_COUNTER_THRESHOLD, e);
+ logger.warn(IGNORE_INVALID_PROPERTY_STRING, IntegrityMonitorProperties.FAILED_COUNTER_THRESHOLD, e);
}
}
testTransIntervalMs = toMillis(
Integer.parseInt(prop.getProperty(IntegrityMonitorProperties.TEST_TRANS_INTERVAL).trim()));
} catch (NumberFormatException e) {
- logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.TEST_TRANS_INTERVAL, e);
+ logger.warn(IGNORE_INVALID_PROPERTY_STRING, IntegrityMonitorProperties.TEST_TRANS_INTERVAL, e);
}
}
writeFpcIntervalMs = toMillis(
Integer.parseInt(prop.getProperty(IntegrityMonitorProperties.WRITE_FPC_INTERVAL).trim()));
} catch (NumberFormatException e) {
- logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.WRITE_FPC_INTERVAL, e);
+ logger.warn(IGNORE_INVALID_PROPERTY_STRING, IntegrityMonitorProperties.WRITE_FPC_INTERVAL, e);
}
}
checkDependencyIntervalMs = toMillis(Integer
.parseInt(prop.getProperty(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL).trim()));
} catch (NumberFormatException e) {
- logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, e);
+ logger.warn(IGNORE_INVALID_PROPERTY_STRING, IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, e);
}
}
logger.debug("dependency groups property = {}", Arrays.toString(depGroups));
}
} catch (Exception e) {
- logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.DEPENDENCY_GROUPS, e);
+ logger.warn(IGNORE_INVALID_PROPERTY_STRING, IntegrityMonitorProperties.DEPENDENCY_GROUPS, e);
}
}
siteName = prop.getProperty(IntegrityMonitorProperties.SITE_NAME);
if (siteName == null) {
- String msg = IntegrityMonitorProperties.SITE_NAME + " property is null";
+ String msg = IntegrityMonitorProperties.SITE_NAME + NULL_PROPERTY_STRING;
logger.error("{}", msg);
- throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
+ throw new IntegrityMonitorPropertiesException(PROPERTY_EXCEPTION_STRING + msg);
} else {
siteName = siteName.trim();
}
nodeType = prop.getProperty(IntegrityMonitorProperties.NODE_TYPE);
if (nodeType == null) {
- String msg = IntegrityMonitorProperties.NODE_TYPE + " property is null";
+ String msg = IntegrityMonitorProperties.NODE_TYPE + NULL_PROPERTY_STRING;
logger.error("{}", msg);
- throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
+ throw new IntegrityMonitorPropertiesException(PROPERTY_EXCEPTION_STRING + msg);
} else {
nodeType = nodeType.trim();
if (!isNodeTypeEnum(nodeType)) {
String msg = IntegrityMonitorProperties.NODE_TYPE + " property " + nodeType + " is invalid";
logger.error("{}", msg);
- throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
+ throw new IntegrityMonitorPropertiesException(PROPERTY_EXCEPTION_STRING + msg);
}
}
maxFpcUpdateIntervalMs = toMillis(
Integer.parseInt(prop.getProperty(IntegrityMonitorProperties.MAX_FPC_UPDATE_INTERVAL).trim()));
} catch (NumberFormatException e) {
- logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.MAX_FPC_UPDATE_INTERVAL, e);
+ logger.warn(IGNORE_INVALID_PROPERTY_STRING, IntegrityMonitorProperties.MAX_FPC_UPDATE_INTERVAL, e);
}
}
stateAuditIntervalMs =
Long.parseLong(prop.getProperty(IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS));
} catch (NumberFormatException e) {
- logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, e);
+ logger.warn(IGNORE_INVALID_PROPERTY_STRING, IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, e);
}
}
refreshStateAuditIntervalMs =
Long.parseLong(prop.getProperty(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS));
} catch (NumberFormatException e) {
- logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS,
+ logger.warn(IGNORE_INVALID_PROPERTY_STRING, IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS,
e);
}
}
- logger.debug("IntegrityMonitor.validateProperties(): Property values \n" + "maxFpcUpdateIntervalMs = {}\n",
+ logger.debug("IntegrityMonitor.validateProperties(): Property values \nmaxFpcUpdateIntervalMs = {}\n",
maxFpcUpdateIntervalMs);
-
- return;
}
/**
try {
validateProperties(newprop);
} catch (IntegrityMonitorPropertiesException e) {
- logger.error("IntegrityMonitor threw exception.", e);
+ logger.error(EXCEPTION_STRING, e);
}
} else {
logger.debug("Update integrity monitor properties not allowed");
return;
}
if (!stateManager.getStandbyStatus().equals(StateManagement.NULL_VALUE)
- && stateManager.getStandbyStatus() != null) {
- if (!stateManager.getStandbyStatus().equals(StateManagement.PROVIDING_SERVICE)) {
- logger.debug("IntegrityMonitor.stateAudit(): NOT PROVIDING_SERVICE. returning");
- return;
- }
+ && stateManager.getStandbyStatus() != null
+ && !stateManager.getStandbyStatus().equals(StateManagement.PROVIDING_SERVICE)) {
+ logger.debug("IntegrityMonitor.stateAudit(): NOT PROVIDING_SERVICE. returning");
+ return;
}
Date date = MonitorTime.getInstance().getDate();
if (diffMs > staleMs) {
// ForwardProgress is stale. Disable it
// Start a transaction
- logger.debug("IntegrityMonitor.executeStateAudit(): resource = {}, FPC is stale. Disabling it");
+ logger.debug("IntegrityMonitor.executeStateAudit(): resource = {}, FPC is stale. Disabling it",
+ fpe.getResourceName());
EntityTransaction et = em.getTransaction();
et.begin();
StateManagementEntity sme = null;
// query if StateManagement entry exists for fpe resource
Query query =
em.createQuery("Select p from StateManagementEntity p where p.resourceName=:resource");
- query.setParameter("resource", fpe.getResourceName());
+ query.setParameter(LC_RESOURCE_STRING, fpe.getResourceName());
@SuppressWarnings("rawtypes")
List smList =
try {
writeFpc();
} catch (Exception e) {
- logger.error("IntegrityMonitor threw exception.", e);
+ logger.error(EXCEPTION_STRING, e);
}
}
logger.debug("checkWriteFpc(): exit");
}
} catch (InterruptedException e) {
- logger.debug("IntegrityMonitor threw exception.", e);
+ logger.debug(EXCEPTION_STRING, e);
Thread.currentThread().interrupt();
}
}
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 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.
public class IntegrityMonitorProperties {
- private IntegrityMonitorProperties() {}
-
public static final String DB_DRIVER = "javax.persistence.jdbc.driver";
public static final String DB_URL = "javax.persistence.jdbc.url";
public static final String DB_USER = "javax.persistence.jdbc.user";
public static final Boolean ALLNOTWELL = Boolean.FALSE;
public static final Boolean ALLSEEMSWELL = Boolean.TRUE;
+ private IntegrityMonitorProperties() {}
}
private static final String RESOURCE_NAME = "resource";
private static final String GET_STATE_MANAGEMENT_ENTITY_QUERY =
"Select p from StateManagementEntity p where p.resourceName=:" + RESOURCE_NAME;
+ private static final String FIND_MESSAGE = "findStateManagementEntity for {}";
private static final Logger logger = LoggerFactory.getLogger(StateManagement.class);
public static final String LOCKED = "locked";
public static final String UNLOCKED = "unlocked";
try {
// Create a StateManagementEntity object
if (logger.isDebugEnabled()) {
- logger.debug("findStateManagementEntity for {}", this.resourceName);
+ logger.debug(FIND_MESSAGE, this.resourceName);
}
final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
if (logger.isDebugEnabled()) {
- logger.debug("findStateManagementEntity for {}", this.resourceName);
+ logger.debug(FIND_MESSAGE, this.resourceName);
}
final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
// set state
try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
if (logger.isDebugEnabled()) {
- logger.debug("findStateManagementEntity for {}", this.resourceName);
+ logger.debug(FIND_MESSAGE, this.resourceName);
}
final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
if (logger.isDebugEnabled()) {
- logger.debug("findStateManagementEntity for {}", this.resourceName);
+ logger.debug(FIND_MESSAGE, this.resourceName);
}
final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
if (logger.isDebugEnabled()) {
- logger.debug("findStateManagementEntity for {}", this.resourceName);
+ logger.debug(FIND_MESSAGE, this.resourceName);
}
final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
if (logger.isDebugEnabled()) {
- logger.debug("findStateManagementEntity for {}", this.resourceName);
+ logger.debug(FIND_MESSAGE, this.resourceName);
}
final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
if (logger.isDebugEnabled()) {
- logger.debug("findStateManagementEntity for " + otherResourceName);
+ logger.debug(FIND_MESSAGE, otherResourceName);
}
final StateManagementEntity sm = findStateManagementEntity(em, otherResourceName);
final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
if (logger.isDebugEnabled()) {
- logger.debug("findStateManagementEntity for {}", this.resourceName);
+ logger.debug(FIND_MESSAGE, this.resourceName);
}
final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
if (logger.isDebugEnabled()) {
- logger.debug("findStateManagementEntity for {}", this.resourceName);
+ logger.debug(FIND_MESSAGE, this.resourceName);
}
final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
if (logger.isDebugEnabled()) {
- logger.debug("findStateManagementEntity for {}", this.resourceName);
+ logger.debug(FIND_MESSAGE, this.resourceName);
}
sm = findStateManagementEntity(em, this.resourceName);
final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
}
if (logger.isDebugEnabled()) {
- logger.debug("StateManagement: promote() operation completed, resourceName = ", this.resourceName);
+ logger.debug("StateManagement: promote() operation completed, resourceName = {}", this.resourceName);
}
if (sm.getStandbyStatus().equals(StateManagement.COLD_STANDBY)) {
final String msg =
public void demote() throws StateManagementException {
synchronized (SYNCLOCK) {
if (logger.isDebugEnabled()) {
- logger.debug("\nStateManagement: SYNCLOCK demote() operation for resourceName = \n", this.resourceName);
- logger.debug("StateManagement: demote() operation started, resourceName = {}", this.resourceName);
+ logger.debug("\nStateManagement: SYNCLOCK demote() operation for resourceName = {}\n",
+ this.resourceName);
+ logger.debug("StateManagement: demote() operation started, resourceName = {}",
+ this.resourceName);
}
final EntityManager em = emf.createEntityManager();
try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
if (logger.isDebugEnabled()) {
- logger.debug("findStateManagementEntity for {}", this.resourceName);
+ logger.debug(FIND_MESSAGE, this.resourceName);
}
final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
public static final String AVAILABLE_STATUS = "availStatus";
public static final String STANDBY_STATUS = "standbyStatus";
public static final String ACTOIN_NAME = "actionName";
+
+ /*
+ * Common strings.
+ */
+ private static final String EXCEPTION_STRING = "Exception:StateTransition unable to process state: adminState=[";
+ private static final String OPSTATE_STRING = "], opState=[";
+ private static final String AVAILSTATUS_STRING = "], availStatus=[";
+ private static final String STANDBY_STRING = "], standbyStatus=[";
+ private static final String ACTION_STRING = "], actionName=[";
private HashMap<String, String> stateTable = new HashMap<>();
standbyStatus = "null";
}
if (adminState == null || opState == null || actionName == null) {
- throw new StateTransitionException("Exception:StateTransition unable to process state: adminState=["
- + adminState + "], opState=[" + opState + "], availStatus=[" + availStatus + "], standbyStatus=["
- + standbyStatus + "], actionName=[" + actionName + "]");
+ throw new StateTransitionException(EXCEPTION_STRING
+ + adminState + OPSTATE_STRING + opState + AVAILSTATUS_STRING + availStatus + STANDBY_STRING
+ + standbyStatus + ACTION_STRING + actionName + "]");
} else if (!(adminState.equals(StateManagement.LOCKED) || adminState.equals(StateManagement.UNLOCKED))) {
- throw new StateTransitionException("Exception:StateTransition unable to process state: adminState=["
- + adminState + "], opState=[" + opState + "], availStatus=[" + availStatus + "], standbyStatus=["
- + standbyStatus + "], actionName=[" + actionName + "]");
+ throw new StateTransitionException(EXCEPTION_STRING
+ + adminState + OPSTATE_STRING + opState + AVAILSTATUS_STRING + availStatus + STANDBY_STRING
+ + standbyStatus + ACTION_STRING + actionName + "]");
} else if (!(opState.equals(StateManagement.ENABLED) || opState.equals(StateManagement.DISABLED))) {
- throw new StateTransitionException("Exception:StateTransition unable to process state: adminState=["
- + adminState + "], opState=[" + opState + "], availStatus=[" + availStatus + "], standbyStatus=["
- + standbyStatus + "], actionName=[" + actionName + "]");
+ throw new StateTransitionException(EXCEPTION_STRING
+ + adminState + OPSTATE_STRING + opState + AVAILSTATUS_STRING + availStatus + STANDBY_STRING
+ + standbyStatus + ACTION_STRING + actionName + "]");
} else if (!(standbyStatus.equals(StateManagement.NULL_VALUE)
|| standbyStatus.equals(StateManagement.COLD_STANDBY)
|| standbyStatus.equals(StateManagement.HOT_STANDBY)
|| standbyStatus.equals(StateManagement.PROVIDING_SERVICE))) {
- throw new StateTransitionException("Exception:StateTransition unable to process state: adminState=["
- + adminState + "], opState=[" + opState + "], availStatus=[" + availStatus + "], standbyStatus=["
- + standbyStatus + "], actionName=[" + actionName + "]");
+ throw new StateTransitionException(EXCEPTION_STRING
+ + adminState + OPSTATE_STRING + opState + AVAILSTATUS_STRING + availStatus + STANDBY_STRING
+ + standbyStatus + ACTION_STRING + actionName + "]");
} else if (!(availStatus.equals(StateManagement.NULL_VALUE) || availStatus.equals(StateManagement.DEPENDENCY)
|| availStatus.equals(StateManagement.DEPENDENCY_FAILED)
|| availStatus.equals(StateManagement.FAILED))) {
- throw new StateTransitionException("Exception:StateTransition unable to process state: adminState=["
- + adminState + "], opState=[" + opState + "], availStatus=[" + availStatus + "], standbyStatus=["
- + standbyStatus + "], actionName=[" + actionName + "]");
+ throw new StateTransitionException(EXCEPTION_STRING
+ + adminState + OPSTATE_STRING + opState + AVAILSTATUS_STRING + availStatus + STANDBY_STRING
+ + standbyStatus + ACTION_STRING + actionName + "]");
} else if (!(actionName.equals(StateManagement.DEMOTE) || actionName.equals(StateManagement.DISABLE_DEPENDENCY)
|| actionName.equals(StateManagement.DISABLE_FAILED)
|| actionName.equals(StateManagement.ENABLE_NO_DEPENDENCY)
|| actionName.equals(StateManagement.ENABLE_NOT_FAILED) || actionName.equals(StateManagement.LOCK)
|| actionName.equals(StateManagement.PROMOTE) || actionName.equals(StateManagement.UNLOCK))) {
- throw new StateTransitionException("Exception:StateTransition unable to process state: adminState=["
- + adminState + "], opState=[" + opState + "], availStatus=[" + availStatus + "], standbyStatus=["
- + standbyStatus + "], actionName=[" + actionName + "]");
+ throw new StateTransitionException(EXCEPTION_STRING
+ + adminState + OPSTATE_STRING + opState + AVAILSTATUS_STRING + availStatus + STANDBY_STRING
+ + standbyStatus + ACTION_STRING + actionName + "]");
}
StateElement stateElement = new StateElement();
}
} else {
- String msg = "Ending state not found, adminState=[" + adminState + "], opState=[" + opState
- + "], availStatus=[" + availStatus + "], standbyStatus=[" + standbyStatus + "], actionName=["
+ String msg = "Ending state not found, adminState=[" + adminState + OPSTATE_STRING + opState
+ + AVAILSTATUS_STRING + availStatus + STANDBY_STRING + standbyStatus + ACTION_STRING
+ actionName + "]";
logger.error("{}", msg);
throw new StateTransitionException(msg);
} catch (Exception ex) {
logger.error("StateTransition threw exception.", ex);
throw new StateTransitionException("Exception: " + ex.toString() + ", adminState=[" + adminState
- + "], opState=[" + opState + "], availStatus=[" + availStatus + "], standbyStatus=[" + standbyStatus
- + "], actionName=[" + actionName + "]");
+ + OPSTATE_STRING + opState + AVAILSTATUS_STRING + availStatus + STANDBY_STRING + standbyStatus
+ + ACTION_STRING + actionName + "]");
}
return stateElement;
* ============LICENSE_START=======================================================
* policy-endpoints
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 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.
public interface HttpClient extends Startable {
+ public static final HttpClientFactory factory = new IndexedHttpClientFactory();
+
public Response get(String path);
public Response get();
public String getBaseUrl();
-
- public static final HttpClientFactory factory = new IndexedHttpClientFactory();
-
}