mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-02 20:42:04 +00:00
33ffd343f3
This is mostly for testing, to avoid hiding errors.
31 lines
954 B
C++
31 lines
954 B
C++
#pragma once
|
|
|
|
#include <Client/IConnections.h>
|
|
#include <Interpreters/Context_fwd.h>
|
|
#include <boost/noncopyable.hpp>
|
|
#include <Common/ThreadPool.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class ConnectionPoolWithFailover;
|
|
using ConnectionPoolWithFailoverPtr = std::shared_ptr<ConnectionPoolWithFailover>;
|
|
|
|
class ConnectionCollector : boost::noncopyable, WithMutableContext
|
|
{
|
|
public:
|
|
static ConnectionCollector & init(ContextMutablePtr global_context_, size_t max_threads);
|
|
static std::shared_ptr<IConnections>
|
|
enqueueConnectionCleanup(const ConnectionPoolWithFailoverPtr & pool, std::shared_ptr<IConnections> connections) noexcept;
|
|
static void drainConnections(IConnections & connections, bool throw_error);
|
|
|
|
private:
|
|
explicit ConnectionCollector(ContextMutablePtr global_context_, size_t max_threads);
|
|
|
|
static constexpr size_t reschedule_time_ms = 1000;
|
|
ThreadPool pool;
|
|
static std::unique_ptr<ConnectionCollector> connection_collector;
|
|
};
|
|
|
|
}
|