MongoDB  2.6.0
Classes | Public Member Functions | List of all members
mongo::DBConnectionPool Class Reference

Database connection pool. More...

#include <connpool.h>

Inheritance diagram for mongo::DBConnectionPool:
mongo::PeriodicTask

Classes

struct  serverNameCompare
 compares server namees, but is smart about replica set names More...
 

Public Member Functions

void setName (const string &name)
 right now just controls some asserts. More...
 
int getMaxPoolSize ()
 Returns the maximum number of connections pooled per-host. More...
 
void setMaxPoolSize (int maxPoolSize)
 Sets the maximum number of connections pooled per-host. More...
 
void onCreate (DBClientBase *conn)
 
void onHandedOut (DBClientBase *conn)
 
void onDestroy (DBClientBase *conn)
 
void flush ()
 
DBClientBaseget (const string &host, double socketTimeout=0)
 
DBClientBaseget (const ConnectionString &host, double socketTimeout=0)
 
void release (const string &host, DBClientBase *c)
 
void addHook (DBConnectionHook *hook)
 
void appendInfo (BSONObjBuilder &b)
 
void clear ()
 Clears all connections for all host.
 
bool isConnectionGood (const string &host, DBClientBase *conn)
 Checks whether the connection for a given host is black listed or not. More...
 
void removeHost (const string &host)
 
virtual string taskName () const
 
virtual void taskDoWork ()
 

Additional Inherited Members

- Static Public Member Functions inherited from mongo::PeriodicTask
static void startRunningPeriodicTasks ()
 Starts the BackgroundJob that runs PeriodicTasks. More...
 
static Status stopRunningPeriodicTasks (int gracePeriodMillis)
 Waits 'gracePeriodMillis' for the BackgroundJob responsible for PeriodicTask execution to finish any running tasks, then destroys it. More...
 

Detailed Description

Database connection pool.

Generally, use ScopedDbConnection and do not call these directly.

This class, so far, is suitable for use with unauthenticated connections. Support for authenticated connections requires some adjustments: please request...

Usage:

{ ScopedDbConnection c("myserver"); c.conn()... }

Member Function Documentation

int mongo::DBConnectionPool::getMaxPoolSize ( )
inline

Returns the maximum number of connections pooled per-host.

This setting only applies to new host connection pools, previously-pooled host pools are unaffected.

bool mongo::DBConnectionPool::isConnectionGood ( const string &  host,
DBClientBase conn 
)

Checks whether the connection for a given host is black listed or not.

Parameters
hostNamethe name of the host the connection connects to.
connthe connection to check.
Returns
true if the connection is not bad, meaning, it is good to keep it for future use.
void mongo::DBConnectionPool::setMaxPoolSize ( int  maxPoolSize)
inline

Sets the maximum number of connections pooled per-host.

This setting only applies to new host connection pools, previously-pooled host pools are unaffected.

void mongo::DBConnectionPool::setName ( const string &  name)
inline

right now just controls some asserts.

defaults to "dbconnectionpool"


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