diff --git a/src/applications/bmqbrkr/m_bmqbrkr_task.cpp b/src/applications/bmqbrkr/m_bmqbrkr_task.cpp index f7205645ea..831716d5d2 100644 --- a/src/applications/bmqbrkr/m_bmqbrkr_task.cpp +++ b/src/applications/bmqbrkr/m_bmqbrkr_task.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -40,6 +39,7 @@ #include #include #include +#include #include namespace BloombergLP { @@ -193,7 +193,7 @@ int Task::onControlMessage(const bsl::string& message) // Intercept the M-Trap to set the name of this PIPE CONTROL CHANNEL thread if (bdlb::String::areEqualCaseless(message, k_MTRAP_SET_THREADNAME)) { - bmqsys::ThreadUtil::setCurrentThreadName("bmqPipeCtrl"); + bslmt::ThreadUtil::setThreadName("bmqPipeCtrl"); return 0; // RETURN } @@ -281,7 +281,7 @@ int Task::initialize(bsl::ostream& errorDescription) d_scheduler.scheduleEvent( bsls::TimeInterval(0, 0), // now - bdlf::BindUtil::bind(&bmqsys::ThreadUtil::setCurrentThreadName, + bdlf::BindUtil::bind(&bslmt::ThreadUtil::setThreadName, "bmqSchedTask")); // ------------- diff --git a/src/groups/bmq/bmqex/bmqex_sequentialcontext.cpp b/src/groups/bmq/bmqex/bmqex_sequentialcontext.cpp index 2e09d0ecc3..50c46029a4 100644 --- a/src/groups/bmq/bmqex/bmqex_sequentialcontext.cpp +++ b/src/groups/bmq/bmqex/bmqex_sequentialcontext.cpp @@ -18,8 +18,6 @@ #include -#include - // BDE #include #include // bsl::swap @@ -109,7 +107,7 @@ SequentialContext::~SequentialContext() // MANIPULATORS int SequentialContext::start() { - return start(bmqsys::ThreadUtil::defaultAttributes()); + return start(bslmt::ThreadAttributes()); } int SequentialContext::start(const bslmt::ThreadAttributes& threadAttributes) diff --git a/src/groups/bmq/bmqex/bmqex_sequentialcontext.h b/src/groups/bmq/bmqex/bmqex_sequentialcontext.h index 2a7a7fa9c1..d8ab6c3617 100644 --- a/src/groups/bmq/bmqex/bmqex_sequentialcontext.h +++ b/src/groups/bmq/bmqex/bmqex_sequentialcontext.h @@ -203,7 +203,7 @@ class SequentialContext { /// function objects on this execution context. Optionally specify a /// `threadAttributes` used to configure the thread. If /// `threadAttributes` is not provided, use the value of - /// `bmqsys::ThreadUtil::defaultAttributes()`. Return 0 on success, and + /// `bslmt::ThreadAttributes()`. Return 0 on success, and /// a non-zero value otherwise. On failure this function has no effect. /// The behavior is undefined unless 'threadAttributes.detachedState() /// == bslmt::ThreadAttributes::e_CREATE_JOINABLE)', or if the working diff --git a/src/groups/bmq/bmqex/bmqex_systemexecutor.h b/src/groups/bmq/bmqex/bmqex_systemexecutor.h index 888ca05b75..2a99d2cd4d 100644 --- a/src/groups/bmq/bmqex/bmqex_systemexecutor.h +++ b/src/groups/bmq/bmqex/bmqex_systemexecutor.h @@ -79,8 +79,6 @@ // // use the executor ... //.. -#include - // BDE #include #include @@ -555,8 +553,7 @@ inline void SystemExecutor::post(BSLS_COMPILERFEATURES_FORWARD_REF(FUNCTION) { SystemExecutor_Context::singleton().executeAsync( BSLS_COMPILERFEATURES_FORWARD(FUNCTION, f), - d_threadAttributes ? *d_threadAttributes - : bmqsys::ThreadUtil::defaultAttributes()); + d_threadAttributes ? *d_threadAttributes : bslmt::ThreadAttributes()); } template diff --git a/src/groups/bmq/bmqex/bmqex_systemexecutor.t.cpp b/src/groups/bmq/bmqex/bmqex_systemexecutor.t.cpp index 90f2f325d2..9d1ae63e51 100644 --- a/src/groups/bmq/bmqex/bmqex_systemexecutor.t.cpp +++ b/src/groups/bmq/bmqex/bmqex_systemexecutor.t.cpp @@ -19,8 +19,6 @@ // TEST DRIVER #include -#include - // BDE #include #include // bsl::cref @@ -155,7 +153,7 @@ static void test2_context_creators() bdlf::BindUtil::bind(bslmt::ThreadUtil::setSpecific, bsl::cref(tlsKey), &threadsCompleted), - bmqsys::ThreadUtil::defaultAttributes()); + bslmt::ThreadAttributes()); } // destroy context singleton object diff --git a/src/groups/bmq/bmqimp/bmqimp_application.cpp b/src/groups/bmq/bmqimp/bmqimp_application.cpp index 663ee23151..7aca25dd6d 100644 --- a/src/groups/bmq/bmqimp/bmqimp_application.cpp +++ b/src/groups/bmq/bmqimp/bmqimp_application.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -668,7 +667,7 @@ Application::Application( // we can not call 'stop' on the scheduler from the 'finalizeCb', and // therefore have to let it stop in the application thread, i.e., from the // destructor of this object. - bslmt::ThreadAttributes attr = bmqsys::ThreadUtil::defaultAttributes(); + bslmt::ThreadAttributes attr = bslmt::ThreadAttributes(); attr.setThreadName("bmqScheduler"); int rc = d_scheduler.start(attr); if (rc != 0) { diff --git a/src/groups/bmq/bmqimp/bmqimp_brokersession.cpp b/src/groups/bmq/bmqimp/bmqimp_brokersession.cpp index ab7c2bd562..7aef81af96 100644 --- a/src/groups/bmq/bmqimp/bmqimp_brokersession.cpp +++ b/src/groups/bmq/bmqimp/bmqimp_brokersession.cpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -64,6 +63,7 @@ #include #include #include +#include #include #include #include @@ -4772,8 +4772,8 @@ bool BrokerSession::appendOrSend( .setFlags(qac.d_header.flags()) .setMessagePropertiesInfo(bmqp::MessagePropertiesInfo(qac.d_header)); - BALL_LOG_DEBUG << "Adding PUT message for retransmission [" - << "GUID: '" << builder.messageGUID() << "'] "; + BALL_LOG_DEBUG << "Adding PUT message for retransmission [" << "GUID: '" + << builder.messageGUID() << "'] "; const bmqt::EventBuilderResult::Enum result = builder.packMessageRaw( qac.d_queueId.id()); @@ -5765,8 +5765,7 @@ BrokerSession::BrokerSession( resetState(); // Spawn the FSM thread - bslmt::ThreadAttributes threadAttributes = - bmqsys::ThreadUtil::defaultAttributes(); + bslmt::ThreadAttributes threadAttributes = bslmt::ThreadAttributes(); threadAttributes.setThreadName("bmqFSMEvtQ"); if (bslmt::ThreadUtil::createWithAllocator( &d_fsmThread, @@ -5855,7 +5854,7 @@ void BrokerSession::setChannel(const bsl::shared_ptr& channel) { // executed by the *IO* thread - bmqsys::ThreadUtil::setCurrentThreadNameOnce("bmqTCPIO"); + bslmt::ThreadUtil::setThreadName("bmqTCPIO"); if (channel) { // We are now connected to bmqbrkr BALL_LOG_INFO << id() diff --git a/src/groups/bmq/bmqimp/bmqimp_eventqueue.cpp b/src/groups/bmq/bmqimp/bmqimp_eventqueue.cpp index eed6047e6b..78dc8e0176 100644 --- a/src/groups/bmq/bmqimp/bmqimp_eventqueue.cpp +++ b/src/groups/bmq/bmqimp/bmqimp_eventqueue.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -450,8 +449,7 @@ int EventQueue::start() &bslma::ManagedPtr::reset, &d_threadPool_mp)); - bslmt::ThreadAttributes threadAttributes = - bmqsys::ThreadUtil::defaultAttributes(); + bslmt::ThreadAttributes threadAttributes = bslmt::ThreadAttributes(); threadAttributes.setThreadName("bmqEventQueue"); d_threadPool_mp.load(new (*d_allocator_p) bdlmt::FixedThreadPool(threadAttributes, diff --git a/src/groups/bmq/bmqsys/bmqsys_threadutil.cpp b/src/groups/bmq/bmqsys/bmqsys_threadutil.cpp deleted file mode 100644 index 61cb4f67bc..0000000000 --- a/src/groups/bmq/bmqsys/bmqsys_threadutil.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2017-2023 Bloomberg Finance L.P. -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// bmqsys_threadutil.cpp -*-C++-*- -#include - -#include - -#include - -// BDE -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace BloombergLP { -namespace bmqsys { - -namespace { -const char k_LOG_CATEGORY[] = "BMQSYS.THREADUTIL"; -} // close unnamed namespace - -// ----------------- -// struct ThreadUtil -// ----------------- - -bslmt::ThreadAttributes ThreadUtil::defaultAttributes() -{ - bslmt::ThreadAttributes attributes; - return attributes; -} - -void ThreadUtil::setCurrentThreadName(const bsl::string& value) -{ - bslmt::ThreadUtil::setThreadName(value); -} - -void ThreadUtil::setCurrentThreadNameOnce(const bsl::string& value) -{ -#ifdef BSLS_PLATFORM_CMP_CLANG - // Suppress "exit-time-destructor" warning on Clang by qualifying the - // static variable 's_named' with Clang-specific attribute. - [[clang::no_destroy]] -#endif - static bmqu::TLSBool s_named(false, true); - - if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!s_named)) { - BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - setCurrentThreadName(value); - s_named = true; - } -} - -} // close package namespace -} // close enterprise namespace diff --git a/src/groups/bmq/bmqsys/bmqsys_threadutil.h b/src/groups/bmq/bmqsys/bmqsys_threadutil.h deleted file mode 100644 index 3c507cd789..0000000000 --- a/src/groups/bmq/bmqsys/bmqsys_threadutil.h +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2017-2023 Bloomberg Finance L.P. -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// bmqsys_threadutil.h -*-C++-*- -#ifndef INCLUDED_BMQSYS_THREADUTIL -#define INCLUDED_BMQSYS_THREADUTIL - -//@PURPOSE: Provide utilities related to thread management. -// -//@CLASSES: -// bmqsys::ThreadUtil: utilities related to thread management. -// -//@DESCRIPTION: 'bmqsys::ThreadUtil' provide a utility namespace for operations -// related to thread management, such as naming threads. Each operation may be -// platform specific, please refer to the associated function documentation for -// individual support explanation. -// -/// NOTE -///---- -// It looks like, in the event of a crash, the generated core name takes the -// currently active thread name instead of the process name, so to make it -// easier to locate the matching core, each thread name we set should start -// with a small recognizable prefix ('BMQ'). - -// BDE -#include -#include - -namespace BloombergLP { -namespace bmqsys { - -// ================= -// struct ThreadUtil -// ================= - -/// Utility namespace for thread management -struct ThreadUtil { - // CLASS METHODS - - /// Return `bslmt::ThreadAttributes` object pre-initialized with default - /// thread parameter values set for the local operating system. - static bslmt::ThreadAttributes defaultAttributes(); - - /// Set the name of the current thread to the specified `value`, truncated - /// to a length of 15 bytes. - /// - /// PLATFORM NOTE: - /// - On platforms other than Linux, Solaris, Darwin, and Windows, this - /// method has no effect. - static void setCurrentThreadName(const bsl::string& value); - - /// Set the name of the current thread to the specified `value`, truncated - /// to a length of 15 bytes. Unlike `setCurrentThreadName`, this method - /// uses a thread local variable to ensure this is done only once per - /// thread. - /// - /// PLATFORM NOTE: - /// - On platforms other than Linux, Solaris, Darwin, and Windows, this - /// method has no effect. - static void setCurrentThreadNameOnce(const bsl::string& value); -}; - -} // close package namespace -} // close enterprise namespace - -#endif diff --git a/src/groups/bmq/bmqsys/doc/bmqsys.txt b/src/groups/bmq/bmqsys/doc/bmqsys.txt index 7b356801e6..c48d89f8b0 100644 --- a/src/groups/bmq/bmqsys/doc/bmqsys.txt +++ b/src/groups/bmq/bmqsys/doc/bmqsys.txt @@ -9,14 +9,13 @@ components to be reused through various applications. /Hierarchical Synopsis /--------------------- -The 'bmqsys' package currently has 5 components having 2 levels of physical +The 'bmqsys' package currently has 4 components having 2 levels of physical dependency. The list below shows the hierarchal ordering of the components. .. 2. bmqsys_mocktime bmqsys_statmonitorsnapshotrecorder 1. bmqsys_statmonitor - bmqsys_threadutil bmqsys_time .. @@ -31,8 +30,5 @@ dependency. The list below shows the hierarchal ordering of the components. : 'bmqsys_statmonitorsnapshotrecorder': : Provide a mechanism to record snapshot of time, cpu, and ctx switch. : -: 'bmqsys_threadutil': -: Provide utilities related to thread management. -: : 'bmqsys_time': : Provide a pluggable functional interface to system clocks. diff --git a/src/groups/bmq/bmqsys/package/bmqsys.mem b/src/groups/bmq/bmqsys/package/bmqsys.mem index bea6d857af..8b6d161047 100644 --- a/src/groups/bmq/bmqsys/package/bmqsys.mem +++ b/src/groups/bmq/bmqsys/package/bmqsys.mem @@ -2,5 +2,4 @@ bmqsys_mocktime bmqsys_operationlogger bmqsys_statmonitor bmqsys_statmonitorsnapshotrecorder -bmqsys_threadutil bmqsys_time diff --git a/src/groups/bmq/bmqtsk/bmqtsk_logcleaner.cpp b/src/groups/bmq/bmqtsk/bmqtsk_logcleaner.cpp index 65b8a193c6..342bdf6f6c 100644 --- a/src/groups/bmq/bmqtsk/bmqtsk_logcleaner.cpp +++ b/src/groups/bmq/bmqtsk/bmqtsk_logcleaner.cpp @@ -20,7 +20,6 @@ #include #include -#include // BDE #include @@ -55,7 +54,7 @@ bslmt::ThreadAttributes logsCleaningThreadAttributes() // NOTE: Use low priority scheduling thread, since the log rotation // operation is a background IO cleanup job. - bslmt::ThreadAttributes attr = bmqsys::ThreadUtil::defaultAttributes(); + bslmt::ThreadAttributes attr = bslmt::ThreadAttributes(); attr.setInheritSchedule(false); attr.setSchedulingPriority( bslmt::ThreadUtil::getMinSchedulingPriority(attr.schedulingPolicy())); diff --git a/src/groups/bmq/bmqu/bmqu_atomicvalidator.t.cpp b/src/groups/bmq/bmqu/bmqu_atomicvalidator.t.cpp index 4b28e72a07..712b09b147 100644 --- a/src/groups/bmq/bmqu/bmqu_atomicvalidator.t.cpp +++ b/src/groups/bmq/bmqu/bmqu_atomicvalidator.t.cpp @@ -16,8 +16,6 @@ // bmqu_atomicvalidator.t.cpp -*-C++-*- #include -#include - // BDE #include #include @@ -215,7 +213,7 @@ static void test2_atomicValidatorMultiThreaded() for (int i = 0; i < k_NUM_THREADS; ++i) { int ret = bslmt::ThreadUtil::createWithAllocator( &handles[i], - bmqsys::ThreadUtil::defaultAttributes(), + bslmt::ThreadAttributes(), bdlf::BindUtil::bindS(bmqtst::TestHelperUtil::allocator(), &acquireReleaseThread, &validator, diff --git a/src/groups/mqb/mqba/mqba_application.cpp b/src/groups/mqb/mqba/mqba_application.cpp index 2b7f5f00e1..1ed4796f28 100644 --- a/src/groups/mqb/mqba/mqba_application.cpp +++ b/src/groups/mqb/mqba/mqba_application.cpp @@ -141,12 +141,12 @@ Application::Application(bdlmt::EventScheduler* scheduler, bslma::Allocator* allocator) : d_allocators(allocator) , d_scheduler_p(scheduler) -, d_adminExecutionPool(bmqsys::ThreadUtil::defaultAttributes(), +, d_adminExecutionPool(bslmt::ThreadAttributes(), 0, 1, bsls::TimeInterval(120).totalMilliseconds(), allocator) -, d_adminRerouteExecutionPool(bmqsys::ThreadUtil::defaultAttributes(), +, d_adminRerouteExecutionPool(bslmt::ThreadAttributes(), 0, 1, bsls::TimeInterval(120).totalMilliseconds(), diff --git a/src/groups/mqb/mqba/mqba_dispatcher.cpp b/src/groups/mqb/mqba/mqba_dispatcher.cpp index 2c07bb3ecc..2e0e1d69a9 100644 --- a/src/groups/mqb/mqba/mqba_dispatcher.cpp +++ b/src/groups/mqb/mqba/mqba_dispatcher.cpp @@ -20,8 +20,6 @@ // BMQ #include -#include - // BDE #include #include @@ -294,7 +292,7 @@ int Dispatcher::startContext(bsl::ostream& errorDescription, // Create and start the threadPool context->d_threadPool_mp.load( new (*d_allocator_p) - bdlmt::ThreadPool(bmqsys::ThreadUtil::defaultAttributes(), + bdlmt::ThreadPool(bslmt::ThreadAttributes(), config.numProcessors(), // min threads config.numProcessors(), // max threads bsl::numeric_limits::max(), // idle time @@ -524,13 +522,13 @@ int Dispatcher::start(bsl::ostream& errorDescription) return rc; // RETURN } - execute(bdlf::BindUtil::bind(&bmqsys::ThreadUtil::setCurrentThreadName, + execute(bdlf::BindUtil::bind(&bslmt::ThreadUtil::setThreadName, "bmqDispSession"), mqbi::DispatcherClientType::e_SESSION); - execute(bdlf::BindUtil::bind(&bmqsys::ThreadUtil::setCurrentThreadName, + execute(bdlf::BindUtil::bind(&bslmt::ThreadUtil::setThreadName, "bmqDispQueue"), mqbi::DispatcherClientType::e_QUEUE); - execute(bdlf::BindUtil::bind(&bmqsys::ThreadUtil::setCurrentThreadName, + execute(bdlf::BindUtil::bind(&bslmt::ThreadUtil::setThreadName, "bmqDispCluster"), mqbi::DispatcherClientType::e_CLUSTER); diff --git a/src/groups/mqb/mqbc/mqbc_clusterdata.cpp b/src/groups/mqb/mqbc/mqbc_clusterdata.cpp index 601e2fe585..c6e35ed0ec 100644 --- a/src/groups/mqb/mqbc/mqbc_clusterdata.cpp +++ b/src/groups/mqb/mqbc/mqbc_clusterdata.cpp @@ -26,8 +26,6 @@ #include #include -#include - // BDE #include #include @@ -134,7 +132,7 @@ ClusterData::ClusterData( d_allocator_p))) , d_stateSpPool(8192, allocator) , d_miscWorkThreadPool( - bmqsys::ThreadUtil::defaultAttributes().setThreadName("bmqMiscWorkTP"), + bslmt::ThreadAttributes().setThreadName("bmqMiscWorkTP"), 3, // numThreads 10000, // maxNumPendingJobs allocator) diff --git a/src/groups/mqb/mqbnet/mqbnet_channel.cpp b/src/groups/mqb/mqbnet/mqbnet_channel.cpp index 1d0ccbce47..939c82a543 100644 --- a/src/groups/mqb/mqbnet/mqbnet_channel.cpp +++ b/src/groups/mqb/mqbnet/mqbnet_channel.cpp @@ -24,7 +24,6 @@ #include #include -#include #include #include @@ -86,7 +85,7 @@ Channel::Channel(bdlbb::BlobBufferFactory* blobBufferFactory, , d_name(name, d_allocator_p) , d_stats() { - bslmt::ThreadAttributes attr = bmqsys::ThreadUtil::defaultAttributes(); + bslmt::ThreadAttributes attr = bslmt::ThreadAttributes(); bsl::string threadName("bmqNet-"); attr.setThreadName(threadName + d_name); d_buffer.setWatermarks(50000, 100000, 500000); diff --git a/src/groups/mqb/mqbnet/mqbnet_elector.cpp b/src/groups/mqb/mqbnet/mqbnet_elector.cpp index ff4cf94867..ef2e28bbca 100644 --- a/src/groups/mqb/mqbnet/mqbnet_elector.cpp +++ b/src/groups/mqb/mqbnet/mqbnet_elector.cpp @@ -23,7 +23,6 @@ #include #include -#include #include // BDE @@ -1055,8 +1054,8 @@ void ElectorStateMachine::applyNodeStatusEventToCandidate( // This node voted for this instance. Remove the node from the list of // supporters. BALL_LOG_INFO - << "Elector:CANDIDATE received NODE_UNAVAILABLE from node" - << " [" << sourceNodeId << "] which voted for this " + << "Elector:CANDIDATE received NODE_UNAVAILABLE from node" << " [" + << sourceNodeId << "] which voted for this " << "CANDIDATE. Removing node from list of voters."; d_supporters.erase(nodeIter); } @@ -1267,8 +1266,8 @@ void ElectorStateMachine::applyScoutingRequestEvent( // Support the notion of sticky leader: if self sees a healthy leader, // notify sender that self won't support it. - BALL_LOG_INFO << "Elector received SCOUTING_REQUEST from " - << "node [" << sourceNodeId << "] with term [" << term + BALL_LOG_INFO << "Elector received SCOUTING_REQUEST from " << "node [" + << sourceNodeId << "] with term [" << term << "]. But self perceives node [" << d_leaderNodeId << "] as a valid leader, with term [" << d_term << "]. Not supporting the scouting node."; @@ -2102,8 +2101,8 @@ void Elector::emitIOEvent(const ElectorStateMachineOutput& output) // Unicast to the specified 'destinationNodeId'. NodesMapIter it = d_nodes.find(output.destination()); if (d_nodes.end() == it) { - BALL_LOG_ERROR << "#ELECTOR_INVALID_NODEID " - << "Invalid nodeId [" << output.destination() + BALL_LOG_ERROR << "#ELECTOR_INVALID_NODEID " << "Invalid nodeId [" + << output.destination() << "] specified while trying to emit event [" << output.io() << "]."; return; // RETURN @@ -2240,7 +2239,7 @@ Elector::Elector(mqbcfg::ElectorConfig& config, d_scheduler.scheduleEvent( bsls::TimeInterval(0, 0), // now - bdlf::BindUtil::bind(&bmqsys::ThreadUtil::setCurrentThreadName, + bdlf::BindUtil::bind(&bslmt::ThreadUtil::setThreadName, "bmqSchedElec")); } diff --git a/src/groups/mqb/mqbnet/mqbnet_tcpsessionfactory.cpp b/src/groups/mqb/mqbnet/mqbnet_tcpsessionfactory.cpp index a8f335e097..198dae70bc 100644 --- a/src/groups/mqb/mqbnet/mqbnet_tcpsessionfactory.cpp +++ b/src/groups/mqb/mqbnet/mqbnet_tcpsessionfactory.cpp @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include @@ -73,6 +72,7 @@ #include #include #include +#include #include #include #include @@ -507,12 +507,11 @@ void TCPSessionFactory::negotiationComplete( if (statusCode != 0) { // Failed to negotiate - BALL_LOG_WARN << "#SESSION_NEGOTIATION " - << "TCPSessionFactory '" << d_config.name() << "' " - << "failed to negotiate a session " - << "[channel: '" << channel.get() - << "', status: " << statusCode << ", error: '" - << errorDescription << "']"; + BALL_LOG_WARN << "#SESSION_NEGOTIATION " << "TCPSessionFactory '" + << d_config.name() << "' " + << "failed to negotiate a session " << "[channel: '" + << channel.get() << "', status: " << statusCode + << ", error: '" << errorDescription << "']"; bmqio::Status status(bmqio::StatusCategory::e_GENERIC_ERROR, "negotiationError", @@ -636,8 +635,8 @@ void TCPSessionFactory::negotiationComplete( // called before or after 'stopListening'. Invoke 'tearDown' // explicitly (it supports subsequent calls). - BALL_LOG_WARN << "#TCP_UNEXPECTED_STATE " - << "TCPSessionFactory '" << d_config.name() + BALL_LOG_WARN << "#TCP_UNEXPECTED_STATE " << "TCPSessionFactory '" + << d_config.name() << (result ? "' has initiated shutdown " : "' has encountered an error ") << "while negotiating a session [session: '" @@ -698,7 +697,7 @@ void TCPSessionFactory::channelStateCallback( // This is an infrequent enough operation (compared to a 'readCb') that it // is fine to do this here (since we have no other ways to // proactively-execute code in the IO threads created by the channelPool). - bmqsys::ThreadUtil::setCurrentThreadNameOnce(d_threadName); + bslmt::ThreadUtil::setThreadName(d_threadName); BALL_LOG_TRACE << "TCPSessionFactory '" << d_config.name() << "': channelStateCallback [event: " << event @@ -711,8 +710,8 @@ void TCPSessionFactory::channelStateCallback( BSLS_ASSERT_SAFE(channel); if (channel->peerUri().empty()) { - BALL_LOG_ERROR << "#SESSION_NEGOTIATION " - << "TCPSessionFactory '" << d_config.name() << "' " + BALL_LOG_ERROR << "#SESSION_NEGOTIATION " << "TCPSessionFactory '" + << d_config.name() << "' " << "rejecting empty peer URI: '" << channel.get() << "'"; @@ -813,8 +812,8 @@ void TCPSessionFactory::onClose( // however, we insert in the d_channels only upon successful // negotiation; therefore a failed to negotiate channel (like during // intrusion testing) would trigger this trace. - BALL_LOG_INFO << "#TCP_UNEXPECTED_STATE " - << "TCPSessionFactory '" << d_config.name() + BALL_LOG_INFO << "#TCP_UNEXPECTED_STATE " << "TCPSessionFactory '" + << d_config.name() << "': OnClose channel for an unknown channel '" << channel.get() << "', " << d_nbActiveChannels << " active channels, status: " << status; @@ -1082,8 +1081,7 @@ int TCPSessionFactory::start(bsl::ostream& errorDescription) bdlf::BindUtil::bind(&stopChannelFactory, d_tcpChannelFactory_mp.get())); - bslmt::ThreadAttributes attributes = - bmqsys::ThreadUtil::defaultAttributes(); + bslmt::ThreadAttributes attributes = bslmt::ThreadAttributes(); attributes.setThreadName("bmqDNSResolver"); rc = d_resolutionContext.start(attributes); BSLS_ASSERT_SAFE(rc == 0); @@ -1224,9 +1222,8 @@ int TCPSessionFactory::startListening(bsl::ostream& errorDescription, void TCPSessionFactory::stopListening() { if (!d_isListening) { - BALL_LOG_WARN << "#TCP_UNEXPECTED_STATE " - << "TCPSessionFactory '" << d_config.name() - << "' is not listening"; + BALL_LOG_WARN << "#TCP_UNEXPECTED_STATE " << "TCPSessionFactory '" + << d_config.name() << "' is not listening"; return; // RETURN } d_isListening = false; @@ -1417,10 +1414,9 @@ int TCPSessionFactory::listen(const mqbcfg::TcpInterfaceListener& listener, bdlf::PlaceHolders::_3, // channel context)); if (!status) { - BALL_LOG_ERROR << "#TCP_LISTEN_FAILED " - << "TCPSessionFactory '" << d_config.name() << "' " - << "failed listening to '" << endpoint.str() - << "' [status: " << status << "]"; + BALL_LOG_ERROR << "#TCP_LISTEN_FAILED " << "TCPSessionFactory '" + << d_config.name() << "' " << "failed listening to '" + << endpoint.str() << "' [status: " << status << "]"; d_isListening = false; return status.category(); // RETURN } @@ -1476,10 +1472,10 @@ int TCPSessionFactory::connect(const bslstl::StringRef& endpoint, context)); if (!status) { - BALL_LOG_ERROR << "#TCP_CONNECT_FAILED " - << "TCPSessionFactory '" << d_config.name() << "' " - << "failed connecting to '" << endpointStream.str() - << "' [status: " << status << "]"; + BALL_LOG_ERROR << "#TCP_CONNECT_FAILED " << "TCPSessionFactory '" + << d_config.name() << "' " << "failed connecting to '" + << endpointStream.str() << "' [status: " << status + << "]"; } else { BALL_LOG_DEBUG << "TCPSessionFactory '" << d_config.name() << "' " diff --git a/src/groups/mqb/mqbstat/mqbstat_statcontroller.cpp b/src/groups/mqb/mqbstat/mqbstat_statcontroller.cpp index 6f3fd1ce27..e20d7eced6 100644 --- a/src/groups/mqb/mqbstat/mqbstat_statcontroller.cpp +++ b/src/groups/mqb/mqbstat/mqbstat_statcontroller.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -729,7 +728,7 @@ int StatController::start(bsl::ostream& errorDescription) d_scheduler_mp->scheduleEvent( bsls::TimeInterval(0), // execute as soon as possible - bdlf::BindUtil::bind(&bmqsys::ThreadUtil::setCurrentThreadName, + bdlf::BindUtil::bind(&bslmt::ThreadUtil::setThreadName, "bmqSchedStat")); // Create and start the system stat monitor. The SystemStats are used in diff --git a/src/plugins/bmqprometheus/bmqprometheus_prometheusstatconsumer.cpp b/src/plugins/bmqprometheus/bmqprometheus_prometheusstatconsumer.cpp index 41ab86f301..f9454d5582 100644 --- a/src/plugins/bmqprometheus/bmqprometheus_prometheusstatconsumer.cpp +++ b/src/plugins/bmqprometheus/bmqprometheus_prometheusstatconsumer.cpp @@ -27,7 +27,6 @@ // BMQ #include #include -#include #include #include @@ -956,7 +955,7 @@ class PrometheusPushStatExporter : public PrometheusStatExporter { void prometheusPushThread() { // executed by the dedicated prometheus push thread - bmqsys::ThreadUtil::setCurrentThreadName(k_THREADNAME); + bslmt::ThreadUtil::setThreadName(k_THREADNAME); BALL_LOG_INFO << "Prometheus Push thread has started [id: " << bslmt::ThreadUtil::selfIdAsUint64() << "]"; @@ -1014,7 +1013,7 @@ class PrometheusPushStatExporter : public PrometheusStatExporter { // create push thread int rc = bslmt::ThreadUtil::create( &d_prometheusPushThreadHandle, - bmqsys::ThreadUtil::defaultAttributes(), + bslmt::ThreadAttributes(), bdlf::BindUtil::bind( &PrometheusPushStatExporter::prometheusPushThread, this));