#include <ControllerPool.hpp>
Static Public Member Functions | |
static AbstractControllerPool & | getPool (std::vector< ControllerInfo > &ctrls, ConnectPolicy cp, int pingDelayInMs, int controllerTimeoutInMs) throw (DriverException, UnexpectedException) |
Returns a pool for the given pair controllers/policy. | |
static void | freePool (AbstractControllerPool *pool) |
Decrements reference counter on the given pool. | |
Static Protected Member Functions | |
static void | tryTocleanUpPools () |
Walks through the pool map to look for pools that can be deleted, ie. |
Permits to have only one instance of ControllerPool for the same controllers and policy, thus to share the connection info (ie. on which controller the last connection occured).
static void CarobNS::ControllerPoolManager::freePool | ( | AbstractControllerPool * | pool | ) | [static] |
Decrements reference counter on the given pool.
If no more references are made on this pool, removes it from the pool list and deletes it
pool | the pool to release |
static AbstractControllerPool& CarobNS::ControllerPoolManager::getPool | ( | std::vector< ControllerInfo > & | ctrls, | |
ConnectPolicy | cp, | |||
int | pingDelayInMs, | |||
int | controllerTimeoutInMs | |||
) | throw (DriverException, UnexpectedException) [static] |
Returns a pool for the given pair controllers/policy.
If the controller pool list already contains a pool suitable for given parameters, returns it after incrementing the reference count on it. If not found, creates a new controller pool, adds it to the list, increments its reference counter and returns it.
ctrls | (ordered) controller list to connect to | |
cp | policy to use | |
pingDelayInMs | Interval in milliseconds between two pings of a controller | |
controllerTimeoutInMs | timeout in milliseconds after which a controller is considered as dead if it did not respond to pings |
DriverException | if the given policy is invalid |
static void CarobNS::ControllerPoolManager::tryTocleanUpPools | ( | ) | [static, protected] |
Walks through the pool map to look for pools that can be deleted, ie.
a pool that is not used anymore and that been freed at least POOL_TIMEOUTms ago