fatalmind::ResourcePoolInterface< Type > Class Template Reference

#include <ResourcePoolInterface.hh>

Inherited by fatalmind::ResourcePool< Type >.

List of all members.


Detailed Description

template<class Type>
class fatalmind::ResourcePoolInterface< Type >

The interface description of a ResourcePool.

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.


Member Function Documentation

template<class Type>
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.

Exceptions:
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.
Deprecated:
Altought it is not really deprecated, the get(), free() fail() mechanism is not the best practice. use the execute() method instead.

Implemented in fatalmind::ResourcePool< Type >.

template<class 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.

Deprecated:
Altought it is not really deprecated, the get(), free() fail() mechanism is not the best practice. use the execute() method instead.

Implemented in fatalmind::ResourcePool< Type >.

template<class 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.

Deprecated:
Altought it is not really deprecated, the get(), free() fail() mechanism is not the best practice. use the execute() method instead.

Implemented in fatalmind::ResourcePool< Type >.

template<class 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 >.


The documentation for this class was generated from the following file:
Generated on Mon Nov 9 16:21:24 2009 for ResourcePool by  doxygen 1.5.3