@@ -356,16 +356,16 @@ struct BuildAckOverflowFunctor {
356356// -------------------------
357357
358358ClientSessionState::ClientSessionState (
359- bslma::ManagedPtr <bmqst::StatContext>& clientStatContext,
360- BlobSpPool* blobSpPool,
361- bdlbb::BlobBufferFactory* bufferFactory,
362- bmqp::EncodingType::Enum encodingType,
363- bslma::Allocator* allocator)
359+ const bsl::shared_ptr <bmqst::StatContext>& clientStatContext,
360+ BlobSpPool* blobSpPool,
361+ bdlbb::BlobBufferFactory* bufferFactory,
362+ bmqp::EncodingType::Enum encodingType,
363+ bslma::Allocator* allocator)
364364: d_allocator_p(allocator)
365365, d_channelBufferQueue(allocator)
366366, d_unackedMessageInfos(d_allocator_p)
367367, d_dispatcherClientData()
368- , d_statContext_mp (clientStatContext)
368+ , d_statContext_sp (clientStatContext)
369369, d_bufferFactory_p(bufferFactory)
370370, d_blobSpPool_p(blobSpPool)
371371, d_schemaEventBuilder(blobSpPool, encodingType, allocator)
@@ -673,7 +673,7 @@ void ClientSession::sendAck(bmqt::AckResult::Enum status,
673673 queueStats = invalidQueueStats ();
674674 }
675675 else {
676- queueStats = subQueueCiter->value ().d_stats .get ();
676+ queueStats = subQueueCiter->value ().d_stats_sp .get ();
677677 }
678678 }
679679
@@ -1916,23 +1916,10 @@ bool ClientSession::validateMessage(mqbi::QueueHandle** queueHandle,
19161916 return false ; // RETURN
19171917 }
19181918
1919- StreamsMap::iterator subQueueIt =
1920- queueIt->second .d_subQueueInfosMap .findBySubIdSafe (queueId.subId ());
1921- if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY (
1922- subQueueIt == queueIt->second .d_subQueueInfosMap .end ())) {
1923- BSLS_PERFORMANCEHINT_UNLIKELY_HINT;
1924-
1925- if (eventType == bmqp::EventType::e_CONFIRM) {
1926- // Update invalid queue stats
1927- invalidQueueStats ()->onEvent (
1928- mqbstat::QueueStatsClient::EventType::e_CONFIRM,
1929- 1 );
1930- }
1931-
1932- *errorStream << " for an unknown subQueueId" ;
1933-
1934- return false ; // RETURN
1935- }
1919+ // Do not lookup 'queueId.subId()'.
1920+ // 'QueueHandle::confirmMessageDispatched' does the check.
1921+ // Note, that it does not update stats (on "bmq://invalid/queue").
1922+ // It does log warnings.
19361923
19371924 *queueHandle = queueIt->second .d_handle_p ;
19381925 BSLS_ASSERT_SAFE (queueHandle);
@@ -1978,13 +1965,6 @@ bool ClientSession::validateMessage(mqbi::QueueHandle** queueHandle,
19781965 return false ; // RETURN
19791966 }
19801967
1981- if (eventType == bmqp::EventType::e_CONFIRM) {
1982- // Update stats for the queue (or subStream of the queue)
1983- subQueueIt->value ().d_stats ->onEvent (
1984- mqbstat::QueueStatsClient::EventType::e_CONFIRM,
1985- 1 );
1986- }
1987-
19881968 return true ;
19891969}
19901970
@@ -2126,7 +2106,7 @@ void ClientSession::onPushEvent(const mqbi::DispatcherPushEvent& event)
21262106 blob->length ());
21272107 }
21282108 else {
2129- subQueueCiter->value ().d_stats -> onEvent (
2109+ subQueueCiter->value ().onEvent (
21302110 mqbstat::QueueStatsClient::EventType::e_PUSH,
21312111 blob->length ());
21322112 }
@@ -2277,9 +2257,8 @@ void ClientSession::onPutEvent(const mqbi::DispatcherPutEvent& event)
22772257 BSLS_ASSERT_SAFE (queueStatePtr && subQueueInfoPtr);
22782258 BSLS_ASSERT_SAFE (queueStatePtr->d_handle_p );
22792259
2280- subQueueInfoPtr->d_stats ->onEvent (
2281- mqbstat::QueueStatsClient::EventType::e_PUT,
2282- appDataSp->length ());
2260+ subQueueInfoPtr->onEvent (mqbstat::QueueStatsClient::EventType::e_PUT,
2261+ appDataSp->length ());
22832262
22842263 const bool isAtMostOnce =
22852264 queueStatePtr->d_handle_p ->queue ()->isAtMostOnce ();
@@ -2446,7 +2425,7 @@ mqbstat::QueueStatsClient* ClientSession::invalidQueueStats()
24462425 d_state.d_invalidQueueStats .makeValue ();
24472426 d_state.d_invalidQueueStats .value ().initialize (
24482427 " bmq://invalid/queue" ,
2449- d_state.d_statContext_mp .get (),
2428+ d_state.d_statContext_sp .get (),
24502429 d_state.d_allocator_p );
24512430 // TBD: The queue uri should be '** INVALID QUEUE **', but that can
24522431 // only be done once the stats UI panel has been updated to
@@ -2649,17 +2628,17 @@ bool ClientSession::validatePutMessage(QueueState** queueState,
26492628
26502629// CREATORS
26512630ClientSession::ClientSession (
2652- const bsl::shared_ptr<bmqio::Channel>& channel,
2653- const bmqp_ctrlmsg::NegotiationMessage& negotiationMessage,
2654- const bsl::string& sessionDescription,
2655- mqbi::Dispatcher* dispatcher,
2656- mqbblp::ClusterCatalog* clusterCatalog,
2657- mqbi::DomainFactory* domainFactory,
2658- bslma::ManagedPtr <bmqst::StatContext>& clientStatContext,
2659- ClientSessionState::BlobSpPool* blobSpPool,
2660- bdlbb::BlobBufferFactory* bufferFactory,
2661- bdlmt::EventScheduler* scheduler,
2662- bslma::Allocator* allocator)
2631+ const bsl::shared_ptr<bmqio::Channel>& channel,
2632+ const bmqp_ctrlmsg::NegotiationMessage& negotiationMessage,
2633+ const bsl::string& sessionDescription,
2634+ mqbi::Dispatcher* dispatcher,
2635+ mqbblp::ClusterCatalog* clusterCatalog,
2636+ mqbi::DomainFactory* domainFactory,
2637+ const bsl::shared_ptr <bmqst::StatContext>& clientStatContext,
2638+ ClientSessionState::BlobSpPool* blobSpPool,
2639+ bdlbb::BlobBufferFactory* bufferFactory,
2640+ bdlmt::EventScheduler* scheduler,
2641+ bslma::Allocator* allocator)
26632642: d_self(this ) // use default allocator
26642643, d_operationState(e_RUNNING)
26652644, d_isDisconnecting(false )
@@ -2680,7 +2659,7 @@ ClientSession::ClientSession(
26802659 allocator)
26812660, d_queueSessionManager(this ,
26822661 *d_clientIdentity_p,
2683- d_state.d_statContext_mp.get() ,
2662+ d_state.d_statContext_sp ,
26842663 domainFactory,
26852664 allocator)
26862665, d_clusterCatalog_p(clusterCatalog)
0 commit comments