#include <pconn.h>

Collaboration diagram for PconnPool:

Public Member Functions

 PconnPool (const char *aDescription, const CbcPointer< PeerPoolMgr > &aMgr)
 
 ~PconnPool ()
 
void moduleInit ()
 
void push (const Comm::ConnectionPointer &serverConn, const char *domain)
 
Comm::ConnectionPointer pop (const Comm::ConnectionPointer &dest, const char *domain, bool keepOpen)
 
void count (int uses)
 
void dump (std::ostream &) const
 
void unlinkList (IdleConnList *list)
 
void noteUses (int uses)
 
void closeN (int n)
 closes any n connections, regardless of their destination More...
 
int count () const
 
void noteConnectionAdded ()
 
void noteConnectionRemoved ()
 
void notifyManager (const char *reason)
 

Private Member Functions

Comm::ConnectionPointer popStored (const Comm::ConnectionPointer &dest, const char *domain, const bool keepOpen)
 
void dumpHist (std::ostream &) const
 
void dumpHash (std::ostream &) const
 

Static Private Member Functions

static const char * key (const Comm::ConnectionPointer &destLink, const char *domain)
 

Private Attributes

int hist [PCONN_HIST_SZ]
 
hash_tabletable
 
const char * descr
 
CbcPointer< PeerPoolMgrmgr
 optional pool manager (for notifications) More...
 
int theCount
 the number of pooled connections More...
 

Detailed Description

Manages idle persistent connections to a caller-defined set of servers (e.g., all HTTP servers). Uses a collection of IdleConnLists internally to list the individual open connections to each server. Controls lists existence and limits the total number of idle connections across the collection.

Definition at line 113 of file pconn.h.

Constructor & Destructor Documentation

◆ PconnPool()

PconnPool::PconnPool ( const char *  aDescription,
const CbcPointer< PeerPoolMgr > &  aMgr 
)

◆ ~PconnPool()

PconnPool::~PconnPool ( )

Member Function Documentation

◆ closeN()

void PconnPool::closeN ( int  n)

Definition at line 516 of file pconn.cc.

References count(), hash_first(), hash_next(), Must, and table.

Referenced by PeerPoolMgr::closeOldConnections().

◆ count() [1/2]

int PconnPool::count ( ) const
inline

Definition at line 142 of file pconn.h.

References theCount.

Referenced by closeN().

◆ count() [2/2]

void PconnPool::count ( int  uses)

◆ dump()

void PconnPool::dump ( std::ostream &  yaml) const

Definition at line 383 of file pconn.cc.

References descr, dumpHash(), and dumpHist().

◆ dumpHash()

void PconnPool::dumpHash ( std::ostream &  yaml) const
private

Definition at line 369 of file pconn.cc.

References IdleConnList::count(), hash_first(), hash_next(), and table.

Referenced by dump().

◆ dumpHist()

void PconnPool::dumpHist ( std::ostream &  yaml) const
private

Definition at line 353 of file pconn.cc.

References hist, and PCONN_HIST_SZ.

Referenced by dump().

◆ key()

const char * PconnPool::key ( const Comm::ConnectionPointer destLink,
const char *  domain 
)
staticprivate

◆ moduleInit()

void PconnPool::moduleInit ( )

◆ noteConnectionAdded()

void PconnPool::noteConnectionAdded ( )
inline

Definition at line 143 of file pconn.h.

References theCount.

Referenced by IdleConnList::push().

◆ noteConnectionRemoved()

void PconnPool::noteConnectionRemoved ( )
inline

Definition at line 144 of file pconn.h.

References assert, and theCount.

Referenced by IdleConnList::closeN(), and IdleConnList::removeAt().

◆ noteUses()

◆ notifyManager()

void PconnPool::notifyManager ( const char *  reason)

Definition at line 509 of file pconn.cc.

References PeerPoolMgr::Checkpoint(), and mgr.

Referenced by IdleConnList::findAndClose(), popStored(), and push().

◆ pop()

Comm::ConnectionPointer PconnPool::pop ( const Comm::ConnectionPointer dest,
const char *  domain,
bool  keepOpen 
)

Returns either a pointer to a popped connection to dest or nil. Closes the connection before returning its pointer unless keepOpen. For connection going to a cache_peer, supports standby connection pools.

A caller with a non-retriable transaction should set keepOpen to false and call pop() anyway, even though the caller does not want a pconn. This forces us to close an available persistent connection, avoiding creating a growing number of open connections when many transactions create (and push) persistent connections but are not retriable and, hence, do not need to pop a connection.

Definition at line 458 of file pconn.cc.

References Comm::Connection::getPeer(), and popStored().

Referenced by HappyConnOpener::reuseOldConnection().

◆ popStored()

Comm::ConnectionPointer PconnPool::popStored ( const Comm::ConnectionPointer dest,
const char *  domain,
const bool  keepOpen 
)
private

implements pop() API while disregarding peer standby pools

Returns
an open connection or nil

Definition at line 477 of file pconn.cc.

References debugs, IdleConnList::findUseable(), hash_lookup(), hashKeyStr(), key(), notifyManager(), and table.

Referenced by pop().

◆ push()

◆ unlinkList()

void PconnPool::unlinkList ( IdleConnList list)

Definition at line 537 of file pconn.cc.

References assert, IdleConnList::count(), hash_remove_link(), table, and theCount.

Referenced by IdleConnList::~IdleConnList().

Member Data Documentation

◆ descr

const char* PconnPool::descr
private

Definition at line 159 of file pconn.h.

Referenced by dump(), and ~PconnPool().

◆ hist

int PconnPool::hist[PCONN_HIST_SZ]
private

Definition at line 157 of file pconn.h.

Referenced by dumpHist(), noteUses(), and PconnPool().

◆ mgr

CbcPointer<PeerPoolMgr> PconnPool::mgr
private

Definition at line 160 of file pconn.h.

Referenced by notifyManager().

◆ table

hash_table* PconnPool::table
private

Definition at line 158 of file pconn.h.

Referenced by closeN(), dumpHash(), PconnPool(), popStored(), push(), unlinkList(), and ~PconnPool().

◆ theCount

int PconnPool::theCount
private

Definition at line 161 of file pconn.h.

Referenced by count(), noteConnectionAdded(), noteConnectionRemoved(), and unlinkList().


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

 

Introduction

Documentation

Support

Miscellaneous