TSocketPool changes
Summary: 1] Added empty constructor
2] Added function to set server list
3] Made getServers return by ref
4] Made list of servers be a list of pointers
The last change is so that someone can pass in the list of servers and rely on TSocketPool to change the failure time directly on the TSocketServer object
Reviewed By: aditya
Test Plan: Ran with a test search server
Revert: OK
DiffCamp Revision: 9529
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665571 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/transport/TSocketPool.h b/lib/cpp/src/transport/TSocketPool.h
index 2d0496b..6c3b0f7 100644
--- a/lib/cpp/src/transport/TSocketPool.h
+++ b/lib/cpp/src/transport/TSocketPool.h
@@ -51,6 +51,12 @@
class TSocketPool : public TSocket {
public:
+
+ /**
+ * Socket pool constructor
+ */
+ TSocketPool();
+
/**
* Socket pool constructor
*
@@ -72,7 +78,7 @@
*
* @param servers list of TSocketPoolServers
*/
- TSocketPool(const std::vector<TSocketPoolServer>& servers);
+ TSocketPool(const std::vector< boost::shared_ptr<TSocketPoolServer> >& servers);
/**
* Socket pool constructor
@@ -92,11 +98,15 @@
*/
void addServer(const std::string& host, int port);
+ /**
+ * Set list of servers in this pool
+ */
+ void setServers(const std::vector< boost::shared_ptr<TSocketPoolServer> >& servers);
/**
* Get list of servers in this pool
*/
- std::vector<TSocketPoolServer> getServers();
+ void getServers(std::vector< boost::shared_ptr<TSocketPoolServer> >& servers);
/**
* Sets how many times to keep retrying a host in the connect function.
@@ -131,7 +141,7 @@
protected:
/** List of servers to connect to */
- std::vector<TSocketPoolServer> servers_;
+ std::vector< boost::shared_ptr<TSocketPoolServer> > servers_;
/** How many times to retry each host in connect */
int numRetries_;