/builddir/build/BUILD/infinispan-hotrod-cpp-6.2.1.Final-Source/include/infinispan/hotrod/ConnectionPoolConfigurationBuilder.h

Go to the documentation of this file.
00001 #ifndef CONNECTIONPOOLCONFIGURATIONBUILDER_H_
00002 #define CONNECTIONPOOLCONFIGURATIONBUILDER_H_
00003 
00004 #include "infinispan/hotrod/ImportExport.h"
00005 #include "Builder.h"
00006 #include "ConfigurationChildBuilder.h"
00007 
00008 namespace infinispan {
00009 namespace hotrod {
00010 
00016 class ConnectionPoolConfigurationBuilder
00017   : public Builder<ConnectionPoolConfiguration>, public ConfigurationChildBuilder
00018 {
00019   public:
00020     ConnectionPoolConfigurationBuilder(ConfigurationBuilder &builder):
00021         ConfigurationChildBuilder(builder),
00022         m_exhaustedAction(WAIT),
00023         m_lifo(true),
00024         m_maxActive(8),
00025         m_maxTotal(-1),
00026         m_maxWait(-1),
00027         m_maxIdle(8),
00028         m_minIdle(0),
00029         m_numTestsPerEvictionRun(3),
00030         m_timeBetweenEvictionRuns(120000),
00031         m_minEvictableIdleTime(1000l * 60l * 30l),
00032         m_testOnBorrow(false),
00033         m_testOnReturn(false),
00034         m_testWhileIdle(true) {}
00035 
00042     ConnectionPoolConfigurationBuilder& exhaustedAction(ExhaustedAction exhaustedAction_) {
00043         m_exhaustedAction = exhaustedAction_;
00044         return *this;
00045     }
00046 
00055     ConnectionPoolConfigurationBuilder& lifo(bool lifo_) {
00056         m_lifo = lifo_;
00057         return *this;
00058     }
00059 
00069     ConnectionPoolConfigurationBuilder& maxActive(int maxActive_) {
00070         m_maxActive = maxActive_;
00071         return *this;
00072     }
00073 
00082     ConnectionPoolConfigurationBuilder& maxTotal(int maxTotal_) {
00083         m_maxTotal = maxTotal_;
00084         return *this;
00085     }
00086 
00094     ConnectionPoolConfigurationBuilder& maxWait(long maxWait_) {
00095         m_maxWait = maxWait_;
00096         return *this;
00097     }
00098 
00106     ConnectionPoolConfigurationBuilder& maxIdle(int maxIdle_) {
00107         m_maxIdle = maxIdle_;
00108         return *this;
00109     }
00110 
00120     ConnectionPoolConfigurationBuilder& minIdle(int minIdle_) {
00121         m_minIdle = minIdle_;
00122         return *this;
00123     }
00124 
00131     ConnectionPoolConfigurationBuilder& numTestsPerEvictionRun(int numTestsPerEvictionRun_) {
00132         m_numTestsPerEvictionRun = numTestsPerEvictionRun_;
00133         return *this;
00134     }
00135 
00143     ConnectionPoolConfigurationBuilder& timeBetweenEvictionRuns(int timeBetweenEvictionRuns_) {
00144         m_timeBetweenEvictionRuns = timeBetweenEvictionRuns_;
00145         return *this;
00146     }
00147 
00157     ConnectionPoolConfigurationBuilder& minEvictableIdleTime(int minEvictableIdleTime_) {
00158         m_minEvictableIdleTime = minEvictableIdleTime_;
00159         return *this;
00160     }
00161 
00169     ConnectionPoolConfigurationBuilder& testOnBorrow(bool testOnBorrow_) {
00170         m_testOnBorrow = testOnBorrow_;
00171         return *this;
00172     }
00173 
00181     ConnectionPoolConfigurationBuilder& testOnReturn(bool testOnReturn_) {
00182         m_testOnReturn = testOnReturn_;
00183         return *this;
00184     }
00185 
00194     ConnectionPoolConfigurationBuilder& testWhileIdle(bool testWhileIdle_) {
00195         m_testWhileIdle = testWhileIdle_;
00196         return *this;
00197     }
00198 
00199     virtual ConnectionPoolConfiguration create() {
00200         return ConnectionPoolConfiguration(
00201             m_exhaustedAction,
00202             m_lifo,
00203             m_maxActive,
00204             m_maxTotal,
00205             m_maxWait,
00206             m_maxIdle,
00207             m_minIdle,
00208             m_numTestsPerEvictionRun,
00209             m_timeBetweenEvictionRuns,
00210             m_minEvictableIdleTime,
00211             m_testOnBorrow,
00212             m_testOnReturn,
00213             m_testWhileIdle);
00214     }
00215     virtual ConnectionPoolConfigurationBuilder& read(ConnectionPoolConfiguration& configuration) {
00216         // FIXME: implement
00217         (void) configuration;
00218         return *this;
00219     }
00220 
00221   private:
00222     ExhaustedAction m_exhaustedAction;
00223     bool m_lifo;
00224     int m_maxActive;
00225     int m_maxTotal;
00226     long m_maxWait;
00227     int m_maxIdle;
00228     int m_minIdle;
00229     int m_numTestsPerEvictionRun;
00230     int m_timeBetweenEvictionRuns;
00231     int m_minEvictableIdleTime;
00232     bool m_testOnBorrow;
00233     bool m_testOnReturn;
00234     bool m_testWhileIdle;
00235 };
00236 
00237 }} //namespace
00238 #endif /* CONNECTIONPOOLCONFIGURATIONBUILDER_H_ */

Generated on 25 Mar 2015 for JBoss Data Grid HotRod C++ Client by  doxygen 1.4.7