private static String jmxFqdn = null;
- // this is the max interval allowed without any forward progress counter updates
+ // this is the max interval seconds allowed without any forward progress counter updates
private static int maxFpcUpdateInterval = IntegrityMonitorProperties.DEFAULT_MAX_FPC_UPDATE_INTERVAL;
// Node types
private static String site_name;
private static String node_type;
private Date refreshStateAuditLastRunDate;
- private int refreshStateAuditIntervalMs = 60000; //run it once per minute
+ private static long refreshStateAuditIntervalMs = 600000; //run it once per 10 minutes
//lock objects
private final Object evaluateSanityLock = new Object();
// create instance of StateMangement class for dependent
StateManagement depStateManager = new StateManagement(emf, dep);
if (depStateManager != null) {
- logger.info("Forward progress not detected for dependent resource " + dep + ". Setting dependent's state to disable failed.");
- depStateManager.disableFailed();
+ if(!depStateManager.getOpState().equals(StateManagement.DISABLED)){
+ logger.info("Forward progress not detected for dependent resource " + dep + ". Setting dependent's state to disable failed.");
+ depStateManager.disableFailed();
+ }
}
} catch (Exception e) {
// ignore errors
}
}
+ if (prop.getProperty(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS) != null){
+ try{
+ 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);
+ }
+ }
return;
}
* check their operational state. If it is not disabled, then disable them.
*/
public void stateAudit() {
-
- //TODO add stateAuditIntervalMs to the IntegrityMonitor properties here and in droolspdp
- // monitoring interval checks
+
if (stateAuditIntervalMs <= 0) {
return; // stateAudit is disabled
}
if(fpe.getResourceName().equals(IntegrityMonitor.resourceName)){
continue;
}
+ //Make sure you are not getting a cached version
+ em.refresh(fpe);
long diffMs = date.getTime() - fpe.getLastUpdated().getTime();
logger.debug("IntegrityMonitor.stateAudit(): diffMs = " + diffMs);
//Threshold for a stale entry
- long staleMs = failedCounterThreshold * monitorInterval * 1000;
+ long staleMs = maxFpcUpdateInterval * 1000;
logger.debug("IntegrityMonitor.stateAudit(): staleMs = " + staleMs);
if(diffMs > staleMs){
* send a notification to all registered observers.
*/
private void refreshStateAudit(){
+ if(refreshStateAuditIntervalMs <=0){
+ // The audit is deactivated
+ return;
+ }
synchronized(refreshStateAuditLock){
logger.debug("refreshStateAudit: entry");
Date now = new Date();
public static final int DEFAULT_FAILED_COUNTER_THRESHOLD = 3;
public static final int DEFAULT_TEST_INTERVAL = 10; //20;
public static final int DEFAULT_WRITE_FPC_INTERVAL = 5;
- public static final int DEFAULT_MAX_FPC_UPDATE_INTERVAL = 60;
+ public static final int DEFAULT_MAX_FPC_UPDATE_INTERVAL = 120;
public static final String FP_MONITOR_INTERVAL = "fp_monitor_interval";
public static final String FAILED_COUNTER_THRESHOLD = "failed_counter_threshold";
public static final String JMX_FQDN = "jmx_fqdn";
public static final String MAX_FPC_UPDATE_INTERVAL = "max_fpc_update_interval";
public static final String STATE_AUDIT_INTERVAL_MS = "state_audit_interval_ms";
+ public static final String REFRESH_STATE_AUDIT_INTERVAL_MS = "refresh_state_audit_interval_ms";
}
//testSanityJmx();
//testIM();
//testSanityState();
- //testRefreshStateAudit();
+ testRefreshStateAudit();
//testStateCheck();
//testGetAllForwardProgressEntity();
- testStateAudit();
+ //testStateAudit();
}
/*
// parameters are passed via a properties file
myProp.put(IntegrityMonitorProperties.DEPENDENCY_GROUPS, "");
myProp.put(IntegrityMonitorProperties.TEST_VIA_JMX, "false");
+ myProp.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS, "60000");
IntegrityMonitor.updateProperties(myProp);
et = em.getTransaction();