blob: 69eb7321c0d88617c303ea9e6ec0b42461669418 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#include "connectionPool.h"
#include <factory.h>
#include <resourcePool.impl.h>
#include <utility>
template class AdHoc::ResourcePool<DB::Connection>;
template class AdHoc::ResourceHandle<DB::Connection>;
namespace DB {
BasicConnectionPool::BasicConnectionPool(unsigned int m, unsigned int k) : ResourcePool<Connection>(m, k) { }
ConnectionPool::ConnectionPool(unsigned int m, unsigned int k, const std::string & t, std::string cs) :
BasicConnectionPool(m, k), factory(ConnectionFactory::get(t)), connectionString(std::move(cs))
{
}
ConnectionPtr
ConnectionPool::createResource() const
{
return factory->create(connectionString);
}
void
BasicConnectionPool::returnTestResource(Connection const * c) const
{
c->finish();
}
void
BasicConnectionPool::testResource(Connection const * c) const
{
c->ping();
}
}
|