fix adapter proxy bug

This commit is contained in:
jarodruan 2020-01-30 17:25:38 +08:00
parent 97c46b8411
commit 08cddb7d4b
2 changed files with 12 additions and 8 deletions

View File

@ -1826,8 +1826,8 @@ void EndpointThread::getEndpoints(vector<EndpointInfo> &activeEndPoint, vector<E
}
{
TC_ThreadLock::Lock lock(_lock);
TC_LockT<TC_SpinLock> lock(_mutex);
// TC_ThreadLock::Lock lock(_mutex);
refreshReg(_type,_name);
@ -1846,7 +1846,7 @@ void EndpointThread::getTCEndpoints(vector<TC_Endpoint> &activeEndPoint, vector<
{
TC_ThreadLock::Lock lock(_lock);
TC_LockT<TC_SpinLock> lock(_mutex);
refreshReg(_type,_name);
@ -1859,7 +1859,7 @@ void EndpointThread::notifyEndpoints(const set<EndpointInfo> & active, const set
{
if(!bSync)
{
TC_ThreadLock::Lock lock(_lock);
TC_LockT<TC_SpinLock> lock(_mutex);
update(active, inactive);
}
@ -1975,7 +1975,7 @@ void EndpointManagerThread::getTCEndpointByStation(const string sName, vector<TC
EndpointThread * EndpointManagerThread::getEndpointThread(GetEndpointType type,const string & sName)
{
TC_ThreadLock::Lock lock(_lock);
TC_LockT<TC_SpinLock> lock(_mutex);
string sAllName = TC_Common::tostr((int)type) + ":" + sName;

View File

@ -17,6 +17,7 @@
#ifndef __TARS_ENDPOINT_MANAGER_H_
#define __TARS_ENDPOINT_MANAGER_H_
#include "util/tc_spin_lock.h"
#include "util/tc_consistent_hash_new.h"
#include "servant/EndpointInfo.h"
#include "servant/EndpointF.h"
@ -362,7 +363,8 @@ private:
/*
* hash值选取一个结点
*/
AdapterProxy* getHashProxy(int64_t hashCode, bool bConsistentHash = false);
AdapterProxy* getHashProxy(int64_t hashCode, bool bConsistentHash = false);
/*
* hash值按取模方式
@ -585,7 +587,8 @@ private:
/*
*
*/
TC_ThreadLock _lock;
// TC_ThreadLock _mutex;
TC_SpinLock _mutex;
/*
@ -680,7 +683,8 @@ private:
/*
*
*/
TC_ThreadLock _lock;
// TC_ThreadLock _mutex;
TC_SpinLock _mutex;
/*
* map