Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ void SimpleScheduledThreadPoolExecutor::cancelTimers() {
void SimpleScheduledThreadPoolExecutor::timerHandler(
const boost::system::error_code& ec, size_t timer_index) {
if (!running_) {
LOG(ERROR)<< "Timer not started.";
return;
}

Expand Down
7 changes: 7 additions & 0 deletions src/cppmetrics/core/scheduled_reporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ void ScheduledReporter::stop() {
}
}

void ScheduledReporter::stopNow() {
if (running_) {
running_ = false;
scheduled_executor_.shutdownNow();
}
}

std::string ScheduledReporter::rateUnitInSec() const {
std::ostringstream ostrstr;
ostrstr << rate_factor_;
Expand Down
6 changes: 6 additions & 0 deletions src/cppmetrics/core/scheduled_reporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ class ScheduledReporter: public Reporter {
*/
virtual void stop();

/**
* Shuts down the background thread that polls/publishes the metrics from the registry, without
* waiting for pending tasks to complete.
*/
virtual void stopNow();

protected:

/**
Expand Down