@Test public void shouldBeInInitialState() { State s; s = createInitialLocalState(somePeriodWhenUnused, 1); assertState(s, true, true, false, normalPeriod, normalPeriod, 0, 0); assertEquals("db load not measured yet", s.getDesc(false)); assertEquals("db load not measured yet", s.getDesc(true)); }
public String getDesc(boolean failover) { if (getStateAfterLastMeasurement(failover) != null) { return getStateAfterLastMeasurement(failover).toString(); } else { return "db load not measured yet"; } }
State implements Serializable, Cloneable { public String getDesc(boolean failover) { if (getStateAfterLastMeasurement(failover) != null) { return getStateAfterLastMeasurement(failover).toString(); } else { return "db load not measured yet"; } } }
State implements Serializable, Cloneable { public String getDesc(boolean failover) { if (getStateAfterLastMeasurement(failover) != null) { return getStateAfterLastMeasurement(failover).toString(); } else { return "db load not measured yet"; } } State(SqlTimeBasedLoadFactory loadFactory,
                 String host,
                 String repoId,
                 int sqlTimesIncludedInAverage,
                 boolean exceptionsIgnoredAfterRecovery,
                 boolean recoveryErasesHistoryIfExceptionsIgnoredAfterRecovery,
                 int currentToUnusedRatio,
                 int backOffMultiplier,
                 int backOffMaxRatio,
                 String mainDbName,
                 String failoverDbName);  State(String host,
                 String repoId,
                 long modifyTimeMillis,
                 boolean failover,
                 long lastMainQueryTimeNanos,
                 long lastFailoverQueryTimeNanos); }
State implements Serializable, Cloneable { public String getDesc(boolean failover) { if (getStateAfterLastMeasurement(failover) != null) { return getStateAfterLastMeasurement(failover).toString(); } else { return "db load not measured yet"; } } State(SqlTimeBasedLoadFactory loadFactory,
                 String host,
                 String repoId,
                 int sqlTimesIncludedInAverage,
                 boolean exceptionsIgnoredAfterRecovery,
                 boolean recoveryErasesHistoryIfExceptionsIgnoredAfterRecovery,
                 int currentToUnusedRatio,
                 int backOffMultiplier,
                 int backOffMaxRatio,
                 String mainDbName,
                 String failoverDbName);  State(String host,
                 String repoId,
                 long modifyTimeMillis,
                 boolean failover,
                 long lastMainQueryTimeNanos,
                 long lastFailoverQueryTimeNanos); @Override State clone(); long getModifyTimeMillis(); Average getAvg(); Average getAvgFailover(); MachineState getMachineState(); String getHost(); String getRepoId(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); State updateLocalStateWithNewExecTimes(MonitorRunLogPrefix logPrefix,
                                                  long mainDbStmtExecTimeNanos,
                                                  long failoverDbStmtExecTimeNanos); void doUpdateLocalStateWithNewExecTimes(MonitorRunLogPrefix logPrefix,
                                                   long mainDbStmtExecTimeNanos,
                                                   long failoverDbStmtExecTimeNanos); State copyFrom(MonitorRunLogPrefix logPrefixIfLocalState, State localOrRemote); boolean sqlTimeIsMeasuredInThisCycle(boolean failover); boolean sqlTimeIsMeasuredInThisCycle(MonitorRunLogPrefix logPrefix, boolean failover); int getPeriod(boolean failover); int getCycleModuloPeriod(boolean failover); Load getLoadAfterLastMeasurement(); String getDesc(boolean failover); }
State implements Serializable, Cloneable { public String getDesc(boolean failover) { if (getStateAfterLastMeasurement(failover) != null) { return getStateAfterLastMeasurement(failover).toString(); } else { return "db load not measured yet"; } } State(SqlTimeBasedLoadFactory loadFactory,
                 String host,
                 String repoId,
                 int sqlTimesIncludedInAverage,
                 boolean exceptionsIgnoredAfterRecovery,
                 boolean recoveryErasesHistoryIfExceptionsIgnoredAfterRecovery,
                 int currentToUnusedRatio,
                 int backOffMultiplier,
                 int backOffMaxRatio,
                 String mainDbName,
                 String failoverDbName);  State(String host,
                 String repoId,
                 long modifyTimeMillis,
                 boolean failover,
                 long lastMainQueryTimeNanos,
                 long lastFailoverQueryTimeNanos); @Override State clone(); long getModifyTimeMillis(); Average getAvg(); Average getAvgFailover(); MachineState getMachineState(); String getHost(); String getRepoId(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); State updateLocalStateWithNewExecTimes(MonitorRunLogPrefix logPrefix,
                                                  long mainDbStmtExecTimeNanos,
                                                  long failoverDbStmtExecTimeNanos); void doUpdateLocalStateWithNewExecTimes(MonitorRunLogPrefix logPrefix,
                                                   long mainDbStmtExecTimeNanos,
                                                   long failoverDbStmtExecTimeNanos); State copyFrom(MonitorRunLogPrefix logPrefixIfLocalState, State localOrRemote); boolean sqlTimeIsMeasuredInThisCycle(boolean failover); boolean sqlTimeIsMeasuredInThisCycle(MonitorRunLogPrefix logPrefix, boolean failover); int getPeriod(boolean failover); int getCycleModuloPeriod(boolean failover); Load getLoadAfterLastMeasurement(); String getDesc(boolean failover); final static long notMeasuredInThisCycle; }