VMware Tanzu GemFire Native C++ Reference 10.3.0
PoolManager.hpp
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#pragma once
19
20#ifndef GEODE_POOLMANAGER_H_
21#define GEODE_POOLMANAGER_H_
22
23#include <iosfwd>
24#include <memory>
25#include <string>
26#include <unordered_map>
27
28#include "Cache.hpp"
29#include "Pool.hpp"
30#include "PoolFactory.hpp"
31#include "Region.hpp"
32#include "geode/HashMapOfPools.hpp"
33#include "internal/geode_base.hpp"
34#include "internal/geode_globals.hpp"
35
36namespace apache {
37namespace geode {
38namespace client {
39
40class CacheImpl;
41class FunctionService;
42class PoolManagerImpl;
43class ThinClientPoolDM;
44class Cache;
45class Pool;
46class PoolFactory;
47class Region;
48class RegionFactory;
49
61class APACHE_GEODE_EXPORT PoolManager {
62 public:
69
80 const HashMapOfPools& getAll() const;
81
89 std::shared_ptr<Pool> find(const std::string& name) const;
90
98 std::shared_ptr<Pool> find(const std::shared_ptr<Region>& region) const;
99
107 void close(bool keepAlive = false);
108
109 private:
110 void removePool(const std::string& name);
111
112 void addPool(std::string name, const std::shared_ptr<Pool>& pool);
113
114 const std::shared_ptr<Pool>& getDefaultPool() const;
115
116 std::shared_ptr<PoolManagerImpl> m_pimpl;
117
118 explicit PoolManager(CacheImpl* cache);
119
120 friend Cache;
121 friend CacheImpl;
122 friend RegionFactory;
123 friend PoolFactory;
124 friend ThinClientPoolDM;
125 friend FunctionService;
126};
127} // namespace client
128} // namespace geode
129} // namespace apache
130
131#endif // GEODE_POOLMANAGER_H_
Caches are obtained from the create method on the CacheFactory#create class.
Definition: Cache.hpp:65
entry point for function execution
Definition: FunctionService.hpp:45
This interface provides for the configuration and creation of instances of Pool.
Definition: PoolFactory.hpp:68
Manages creation and access to connection pools for clients.
Definition: PoolManager.hpp:61
std::shared_ptr< Pool > find(const std::shared_ptr< Region > &region) const
Find the pool used by the given region.
std::shared_ptr< Pool > find(const std::string &name) const
Find by name an existing connection pool returning the existing pool or nullptr if it does not exist.
void close(bool keepAlive=false)
Unconditionally destroys all created pools that are in this manager.
PoolFactory createFactory() const
Creates a new pool factory, which is used to configure and create new Pools.
const HashMapOfPools & getAll() const
Returns a map containing all the pools in this manager.
Provides for the configuration and creation of instances of Region.
Definition: RegionFactory.hpp:43

Apache Geode C++ Cache API Documentation