connection_pool.cpp.svn-base

来自「自己写的」· SVN-BASE 代码 · 共 94 行

SVN-BASE
94
字号
/*  Copy Left/Right : OTHER ,Amfproject                                     * *                                                                          * *     This program is free software; you can redistribute it and/or modify * *  it under the terms of the GNU General Public License as published by    * *  the Free Software Foundation; version 2 of the License.                 * *                                                                          * *  This program is distributed in the hope that it will be useful,         * *  but WITHOUT ANY WARRANTY; without even the implied warranty of          * *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           * *  GNU General Public License for more details.                            * *                                                                          * *  You should have received a copy of the GNU General Public License       * *  along with this program; if not, write to the Free Software             * *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA* **************************************************************************** * Project:    LibKDD0 * Programmer: lucy * Created On: Jan 16, 2009 ****************************************************************************//*-- Compiler Controls -----------------------------------------------------*//*-- Includes --------------------------------------------------------------*/#include <datafarm/connection_pool.hpp>#include <datafarm/datafarm_configure.hpp>#include <boost/bind.hpp>#include <xercesc/util/PlatformUtils.hpp>#include <xercesc/sax2/SAX2XMLReader.hpp>#include <xercesc/sax2/XMLReaderFactory.hpp>#include <xercesc/sax2/DefaultHandler.hpp>#include <kdd/xmlutil.hpp>XERCES_CPP_NAMESPACE_USE/*-- Namespace Controller --------------------------------------------------*/namespace kdd{/*-- External function prototypes ------------------------------------------*//*-- Local function prototypes ---------------------------------------------*//*--------------------------------------------------------------------------*///connection_pool& createPool(std::string const &cfgfile)//{//	try//	{//		 XMLPlatformUtils::Initialize();//	}catch(std::exception const & e)//	{////	}////	SAX2XMLReader* pParser = XMLReaderFactory::createXMLReader();//	kdd::datafarm_configure_handler h;//	pParser->setContentHandler(&h);//	pParser->parse(cfgfile.c_str());//	const datafarm_configure& conf=h.getConf();//	connection_pool *dbio=new connection_pool(conf.server,conf.database,conf.user,conf.pass,conf.PoolSize,conf.PoolSize);//	XMLPlatformUtils::Terminate();//	return *dbio;//}void connection_pool::run(){	for (std::size_t i = 0; i < threadPoolInitSize; ++i)	{		boost::shared_ptr<boost::thread> thread(new boost::thread(boost::bind(&kdd::dbioservice::run,&ios)));		threads.push_back(thread);	}	for (std::size_t i = 0; i < threads.size(); ++i)		threads[i]->join();	currentThreadSize = threadPoolInitSize;}void connection_pool::stopPool(){	for (std::size_t i = 0; i < threads.size(); ++i)		threads[i]->yield();}connection_pool::~connection_pool(){}/*-- Namespace Ender -------------------------------------------------------*/}/*--------------------------------------------------------------------------*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?