XRootD
Loading...
Searching...
No Matches
TPC::TPCRequestManager Class Referencefinal

#include <XrdHttpTpcPool.hh>

+ Collaboration diagram for TPC::TPCRequestManager:

Classes

class  TPCRequest
 

Public Member Functions

 TPCRequestManager (XrdOucEnv &xrdEnv, XrdSysError &eDest)
 
bool Produce (TPCRequest &handler)
 
void SetMaxIdleRequests (unsigned max_pending_ops)
 
void SetMaxWorkers (unsigned max_workers)
 
void SetWorkerIdleTimeout (std::chrono::steady_clock::duration dur)
 

Detailed Description

Definition at line 38 of file XrdHttpTpcPool.hh.

Constructor & Destructor Documentation

◆ TPCRequestManager()

TPCRequestManager::TPCRequestManager ( XrdOucEnv & xrdEnv,
XrdSysError & eDest )

Definition at line 396 of file XrdHttpTpcPool.cc.

396: m_log(eDest), m_xrdEnv(xrdEnv) {}
static XrdSysError eDest(0,"crypto_")

References eDest.

Member Function Documentation

◆ Produce()

bool TPCRequestManager::Produce ( TPCRequestManager::TPCRequest & handler)

Definition at line 403 of file XrdHttpTpcPool.cc.

403 {
404 std::shared_ptr<TPCQueue> queue;
405 // Get the queue from our per-label map. To avoid a race condition,
406 // if the queue we get has already been shut down, we release the lock
407 // and try again (with the expectation that the queue will eventually
408 // get the lock and remove itself from the map).
409 while (true) {
410 m_mutex.lock_shared();
411 std::lock_guard<std::shared_mutex> guard{m_mutex, std::adopt_lock};
412 auto iter = m_pool_map.find(handler.GetLabel());
413 if (iter != m_pool_map.end()) {
414 if (!iter->second->IsDone()) {
415 queue = iter->second;
416 break;
417 }
418 } else {
419 break;
420 }
421 }
422 if (!queue) {
423 auto created_queue = false;
424 std::string queue_name = "";
425 {
426 std::lock_guard<std::shared_mutex> guard(m_mutex);
427 auto iter = m_pool_map.find(handler.GetLabel());
428 if (iter == m_pool_map.end()) {
429 queue = std::make_shared<TPCQueue>(handler.GetLabel(), *this);
430 m_pool_map.insert(iter, {handler.GetLabel(), queue});
431 created_queue = true;
432 queue_name = handler.GetLabel();
433 } else {
434 queue = iter->second;
435 }
436 }
437 if (created_queue) {
438 m_log.Log(LogMask::Info, "RequestManager", "Created new TPC request queue for", queue_name.c_str());
439 }
440 }
441
442 return queue->Produce(handler);
443}

References TPC::TPCRequestManager::TPCRequest::GetLabel(), and TPC::Info.

+ Here is the call graph for this function:

◆ SetMaxIdleRequests()

void TPC::TPCRequestManager::SetMaxIdleRequests ( unsigned max_pending_ops)
inline

Definition at line 78 of file XrdHttpTpcPool.hh.

78{ m_max_pending_ops = max_pending_ops; }

◆ SetMaxWorkers()

void TPC::TPCRequestManager::SetMaxWorkers ( unsigned max_workers)
inline

Definition at line 77 of file XrdHttpTpcPool.hh.

77{ m_max_workers = max_workers; }

◆ SetWorkerIdleTimeout()

void TPCRequestManager::SetWorkerIdleTimeout ( std::chrono::steady_clock::duration dur)

Definition at line 398 of file XrdHttpTpcPool.cc.

398{ m_idle_timeout = dur; }

The documentation for this class was generated from the following files: