if (doOnEntry()) {
query_filter_.serveNoScopes();
adjustNetworkState();
+
+ // Log if the state machine is paused.
+ conditionalLogPausedState();
}
// There is nothing to do in that state. This server simply receives
if (doOnEntry()) {
query_filter_.serveDefaultScopes();
adjustNetworkState();
+
+ // Log if the state machine is paused.
+ conditionalLogPausedState();
}
scheduleHeartbeat();
query_filter_.serveDefaultScopes();
}
adjustNetworkState();
+
+ // Log if the state machine is paused.
+ conditionalLogPausedState();
}
scheduleHeartbeat();
if (doOnEntry()) {
query_filter_.serveNoScopes();
adjustNetworkState();
+
+ // Log if the state machine is paused.
+ conditionalLogPausedState();
}
scheduleHeartbeat();
if (doOnEntry()) {
query_filter_.serveNoScopes();
adjustNetworkState();
+
+ // Log if the state machine is paused.
+ conditionalLogPausedState();
}
if (isModelPaused()) {
// In the terminated state we don't send heartbeat.
communication_state_->stopHeartbeat();
+ // Log if the state machine is paused.
+ conditionalLogPausedState();
+
LOG_ERROR(ha_logger, HA_TERMINATED);
}
if (doOnEntry()) {
query_filter_.serveNoScopes();
adjustNetworkState();
+
+ // Log if the state machine is paused.
+ conditionalLogPausedState();
}
// Only schedule the heartbeat for non-backup servers.
.arg(new_state_name);
}
}
-
- // Inform the administrator if the state machine is paused.
- if (isModelPaused()) {
- std::string state_name = stateToString(state);
- boost::to_upper(state_name);
- LOG_INFO(ha_logger, HA_STATE_MACHINE_PAUSED)
- .arg(state_name);
- }
}
bool
return (false);
}
+void
+HAService::conditionalLogPausedState() const {
+ // Inform the administrator if the state machine is paused.
+ if (isModelPaused()) {
+ std::string state_name = stateToString(getCurrState());
+ boost::to_upper(state_name);
+ LOG_INFO(ha_logger, HA_STATE_MACHINE_PAUSED)
+ .arg(state_name);
+ }
+}
+
void
HAService::serveDefaultScopes() {
query_filter_.serveDefaultScopes();
/// machine was not paused when this method was invoked.
bool unpause();
+protected:
+
+ /// @brief Logs if the server is paused in the current state.
+ ///
+ /// This method is internally called by the state handlers upon
+ /// entry to a new state.
+ void conditionalLogPausedState() const;
+
+public:
+
/// @brief Instructs the HA service to serve default scopes.
///
/// This method is mostly useful for unit testing. The scopes need to be