|
|
|
@ -29,20 +29,9 @@ |
|
|
|
|
namespace grpc_core { |
|
|
|
|
|
|
|
|
|
// The global subchannel pool. It shares subchannels among channels. There
|
|
|
|
|
// should be only one instance of this class. Init() should be called once at
|
|
|
|
|
// the filter initialization time; Shutdown() should be called once at the
|
|
|
|
|
// filter shutdown time.
|
|
|
|
|
// should be only one instance of this class.
|
|
|
|
|
class GlobalSubchannelPool final : public SubchannelPoolInterface { |
|
|
|
|
public: |
|
|
|
|
// The ctor and dtor are not intended to use directly.
|
|
|
|
|
GlobalSubchannelPool() {} |
|
|
|
|
~GlobalSubchannelPool() override {} |
|
|
|
|
|
|
|
|
|
// Should be called exactly once at filter initialization time.
|
|
|
|
|
static void Init(); |
|
|
|
|
// Should be called exactly once at filter shutdown time.
|
|
|
|
|
static void Shutdown(); |
|
|
|
|
|
|
|
|
|
// Gets the singleton instance.
|
|
|
|
|
static RefCountedPtr<GlobalSubchannelPool> instance(); |
|
|
|
|
|
|
|
|
@ -57,9 +46,8 @@ class GlobalSubchannelPool final : public SubchannelPoolInterface { |
|
|
|
|
ABSL_LOCKS_EXCLUDED(mu_); |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
// The singleton instance. (It's a pointer to RefCountedPtr so that this
|
|
|
|
|
// non-local static object can be trivially destructible.)
|
|
|
|
|
static RefCountedPtr<GlobalSubchannelPool>* instance_; |
|
|
|
|
GlobalSubchannelPool() {} |
|
|
|
|
~GlobalSubchannelPool() override {} |
|
|
|
|
|
|
|
|
|
// A map from subchannel key to subchannel.
|
|
|
|
|
std::map<SubchannelKey, Subchannel*> subchannel_map_ ABSL_GUARDED_BY(mu_); |
|
|
|
|