📄 connection_pool.cpp.svn-base
字号:
/* 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -