We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在BfdCodis.cpp中:
BfdCodis::BfdCodis(const string& zookeeperAddr, const string& proxyPath, const string& businessID) { m_Pool = new RoundRobinCodisPool(zookeeperAddr, proxyPath, businessID); } BfdCodis::~BfdCodis() { if (m_Pool = NULL) { delete m_Pool; m_Pool = NULL; } } bool BfdCodis::exists(string key, int tt) { return m_Pool->GetProxy()->exists(key, tt); } int BfdCodis::del(string key, int tt) { return m_Pool->GetProxy()->del(key, tt); }
这段代码的m_Pool->GetProxy()得到的CodisClient实例,有可能会在RoundRobinCodisPool中被析构。
建议的更新方法:
The text was updated successfully, but these errors were encountered:
一个高效的写法:
{ ScopedLock lock(m_Mutex); int idx = ++proxyIndex % m_Proxys.size() } return m_Proxys[idx];
Sorry, something went wrong.
有一天proxyIndex会溢出
可以这样:int idx = crc32(key)%m_Proxys.size()
abigbigbird
No branches or pull requests
在BfdCodis.cpp中:
这段代码的m_Pool->GetProxy()得到的CodisClient实例,有可能会在RoundRobinCodisPool中被析构。
建议的更新方法:
The text was updated successfully, but these errors were encountered: