#include <ResourcePoolInterface.hh>
Inherited by fatalmind::ResourcePool< Type >.
Theroretically shared with LoadBalancer, which does not yet exist.
Public Member Functions | |
virtual Type::resource_t & | get ()=0 |
Returns a plain resource to be used. | |
virtual bool | free (typename Type::resource_t &)=0 |
Marks a resource as free. | |
virtual bool | fail (typename Type::resource_t &)=0 |
Marks a resource as bad. | |
virtual void | execute (Command< Type > &cmd)=0 |
Executes a command with a resource from this pool. |
virtual Type::resource_t& fatalmind::ResourcePoolInterface< Type >::get | ( | ) | [pure virtual] |
Returns a plain resource to be used.
This has to be free()ed or fail()ed.
CreateException | If the ResourcePool could not find a valid resource within the given constraints (MaxTry, Max). | |
... | Other exceptions may arise, especially if thrown in Factory::create_resource. |
Implemented in fatalmind::ResourcePool< Type >.
virtual bool fatalmind::ResourcePoolInterface< Type >::free | ( | typename Type::resource_t & | ) | [pure virtual] |
Marks a resource as free.
This resource will be re-used by get() calls. The free() method calls the postcheck() method of the resource to determine if the resource is valid.
Implemented in fatalmind::ResourcePool< Type >.
virtual bool fatalmind::ResourcePoolInterface< Type >::fail | ( | typename Type::resource_t & | ) | [pure virtual] |
Marks a resource as bad.
The ResourcePool will throw this resource away and NOT return it to the pool of available connections.
Implemented in fatalmind::ResourcePool< Type >.
virtual void fatalmind::ResourcePoolInterface< Type >::execute | ( | Command< Type > & | cmd | ) | [pure virtual] |
Executes a command with a resource from this pool.
Using this method is the recommended way to use ResourcePool. It handles the processing of get()/free()/fail() calls.
See Command::execute for details how to implement such commands, or see PoolType::Commands for a list of available commands for a PoolType.
Implemented in fatalmind::ResourcePool< Type >.