bool registerPool(const ConnectionCreator<Connection>& creator,int initialSize,int maxSize) 
    {	    
	mutex::scoped_lock lock(mutex_);
	if (pools_.find(creator.id())==pools_.end())
	{
	    return pools_.insert(std::make_pair(creator.id(),
						boost::shared_ptr<PoolType>(new PoolType(creator,initialSize,maxSize)))).second;
	}

	return false;
	   	     
    }
    bool registerPool(const ConnectionCreator<Connection> &creator, size_t initialSize, size_t maxSize) {
        ContType::const_iterator itr = pools_.find(creator.id());

        if (itr != pools_.end()) {
            itr->second->set_initial_size(initialSize);
            itr->second->set_max_size(maxSize);
        } else
            return pools_.insert(
                std::make_pair(creator.id(), boost::make_shared<PoolType>(creator, initialSize,maxSize))).second;

        return false;

    }
    bool registerPool(ConnectionCreator<Connection> const& creator,unsigned initialSize,unsigned maxSize)
    {
        ContType::const_iterator itr = pools_.find(creator.id());

        if (itr != pools_.end())
        {
            itr->second->set_initial_size(initialSize);
            itr->second->set_max_size(maxSize);
        }
        else
        {
            return pools_.insert(
                std::make_pair(creator.id(),
                               std::make_shared<PoolType>(creator,initialSize,maxSize))).second;
        }
        return false;

    }
示例#4
0
    bool registerPool(ConnectionCreator<Connection> const& creator,unsigned initialSize,unsigned maxSize)
    {
#ifdef MAPNIK_THREADSAFE
        std::lock_guard<std::mutex> lock(mutex_);
#endif
        ContType::const_iterator itr = pools_.find(creator.id());

        if (itr != pools_.end())
        {
            itr->second->set_initial_size(initialSize);
            itr->second->set_max_size(maxSize);
        }
        else
        {
            return pools_.insert(
                std::make_pair(creator.id(),
                               std::make_shared<PoolType>(creator,initialSize,maxSize))).second;
        }
        return false;

    }