Source:
public synchronized void transitionAppropriately() { log.debug("Attempting to transition to appropriate Mode"); try { QpidStatus status = qmf.getStatus(); CandlepinModeChange modeChange = modeManager.getLastCandlepinModeChange(); log.debug("Qpid status is {}, the current mode is {}", status, modeChange); if (status != QpidStatus.CONNECTED) { qpidConnection.setConnectionStatus(STATUS.JMS_OBJECTS_STALE); } if (modeChange.getMode() == Mode.SUSPEND) { switch (status) { case CONNECTED: log.info("Connection to qpid is restored! Reconnecting Qpid and" + " Entering NORMAL mode"); failedAttempts = 0; modeManager.enterMode(Mode.NORMAL, Reason.QPID_UP); break; case FLOW_STOPPED: case DOWN: failedAttempts++; log.debug("Staying in mode. So far failed attempts", status, failedAttempts); break; default: throw new RuntimeException("Unknown status: " + status); } } else if (modeChange.getMode() == Mode.NORMAL) { switch (status) { case FLOW_STOPPED: log.debug("Will need to transition Candlepin into SUSPEND Mode because " + "the Qpid connection is flow stopped"); modeManager.enterMode(Mode.SUSPEND, Reason.QPID_FLOW_STOPPED); break; case DOWN: log.debug("Will need to transition Candlepin into SUSPEND Mode because " + "the Qpid connection is down"); modeManager.enterMode(Mode.SUSPEND, Reason.QPID_DOWN); break; case CONNECTED: log.debug("Connection to Qpid is ok and current mode is NORMAL. No-op!"); break; default: throw new RuntimeException("Unknown status: " + status); } } } catch (Throwable t) { log.error("Error while executing period Suspend Watchdog check", t); } }

Target:
public synchronized void transitionAppropriately() { log.debug("Attempting to transition to appropriate Mode"); try { QpidStatus status = qmf.getStatus(); CandlepinModeChange modeChange = modeManager.getLastCandlepinModeChange(); log.debug("Qpid status is {}, the current mode is {}", status, modeChange); if (status != QpidStatus.CONNECTED) { qpidConnection.setConnectionStatus(STATUS.JMS_OBJECTS_STALE); } if (modeChange.getMode() == Mode.SUSPEND) { switch (status) { case CONNECTED: log.info("Connection to qpid is restored! Reconnecting Qpid and" + " Entering NORMAL mode"); failedAttempts = BigInteger.ZERO; modeManager.enterMode(Mode.NORMAL, Reason.QPID_UP); cleanStatusCache(); break; case FLOW_STOPPED: case DOWN: failedAttempts = failedAttempts.add(BigInteger.ONE); log.debug("Staying in mode. So far failed attempts", status, failedAttempts); break; default: throw new RuntimeException("Unknown status: " + status); } } else if (modeChange.getMode() == Mode.NORMAL) { switch (status) { case FLOW_STOPPED: log.debug("Will need to transition Candlepin into SUSPEND Mode because " + "the Qpid connection is flow stopped"); modeManager.enterMode(Mode.SUSPEND, Reason.QPID_FLOW_STOPPED); cleanStatusCache(); break; case DOWN: log.debug("Will need to transition Candlepin into SUSPEND Mode because " + "the Qpid connection is down"); modeManager.enterMode(Mode.SUSPEND, Reason.QPID_DOWN); cleanStatusCache(); break; case CONNECTED: log.debug("Connection to Qpid is ok and current mode is NORMAL. No-op!"); break; default: throw new RuntimeException("Unknown status: " + status); } } } catch (Throwable t) { log.error("Error while executing period Suspend Transitioner check", t); } }