summaryrefslogtreecommitdiff
path: root/src/mongo/transport/service_executor.cpp
diff options
context:
space:
mode:
authorBen Caimano <ben.caimano@10gen.com>2020-12-15 22:40:20 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-01-06 20:58:51 +0000
commit6020123ae6d42a31a9564ab96ab4979d1acd4f5a (patch)
treed679f44e4fbfd88edba5e669a9cbc48e3f8c2933 /src/mongo/transport/service_executor.cpp
parent0615cd112f6cbe12ad6aab52319903a954158da5 (diff)
downloadmongo-6020123ae6d42a31a9564ab96ab4979d1acd4f5a.tar.gz
SERVER-53421 Provide ways to track Session cleanup
Diffstat (limited to 'src/mongo/transport/service_executor.cpp')
-rw-r--r--src/mongo/transport/service_executor.cpp34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/mongo/transport/service_executor.cpp b/src/mongo/transport/service_executor.cpp
index 18efe4c1013..4ec30e50609 100644
--- a/src/mongo/transport/service_executor.cpp
+++ b/src/mongo/transport/service_executor.cpp
@@ -70,11 +70,11 @@ StringData toString(ServiceExecutor::ThreadingModel threadingModel) {
}
}
-Status ServiceExecutor::setInitialThreadingModel(StringData value) noexcept {
+Status ServiceExecutor::setInitialThreadingModelFromString(StringData value) noexcept {
if (value == kThreadingModelDedicatedStr) {
- gInitialThreadingModel = ServiceExecutor::ThreadingModel::kDedicated;
+ setInitialThreadingModel(ServiceExecutor::ThreadingModel::kDedicated);
} else if (value == kThreadingModelBorrowedStr) {
- gInitialThreadingModel = ServiceExecutor::ThreadingModel::kBorrowed;
+ setInitialThreadingModel(ServiceExecutor::ThreadingModel::kBorrowed);
} else {
MONGO_UNREACHABLE;
}
@@ -82,6 +82,10 @@ Status ServiceExecutor::setInitialThreadingModel(StringData value) noexcept {
return Status::OK();
}
+void ServiceExecutor::setInitialThreadingModel(ThreadingModel threadingModel) noexcept {
+ gInitialThreadingModel = threadingModel;
+}
+
auto ServiceExecutor::getInitialThreadingModel() noexcept -> ThreadingModel {
return gInitialThreadingModel;
}
@@ -266,5 +270,29 @@ void ServiceExecutor::yieldIfAppropriate() const {
}
}
+void ServiceExecutor::shutdownAll(ServiceContext* serviceContext, Date_t deadline) {
+ auto getTimeout = [&] {
+ auto now = serviceContext->getPreciseClockSource()->now();
+ return std::max(Milliseconds{0}, deadline - now);
+ };
+
+ if (auto status = transport::ServiceExecutorFixed::get(serviceContext)->shutdown(getTimeout());
+ !status.isOK()) {
+ LOGV2(4907202, "Failed to shutdown ServiceExecutorFixed", "error"_attr = status);
+ }
+
+ if (auto exec = transport::ServiceExecutorReserved::get(serviceContext)) {
+ if (auto status = exec->shutdown(getTimeout()); !status.isOK()) {
+ LOGV2(4907201, "Failed to shutdown ServiceExecutorReserved", "error"_attr = status);
+ }
+ }
+
+ if (auto status =
+ transport::ServiceExecutorSynchronous::get(serviceContext)->shutdown(getTimeout());
+ !status.isOK()) {
+ LOGV2(4907200, "Failed to shutdown ServiceExecutorSynchronous", "error"_attr = status);
+ }
+}
+
} // namespace transport
} // namespace mongo