Pivotal GemFire Native C++ Reference  10.1.3
PoolFactory.hpp
Go to the documentation of this file.
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_POOLFACTORY_H_
21 #define GEODE_POOLFACTORY_H_
22 
23 #include <chrono>
24 
25 #include "Pool.hpp"
26 #include "internal/chrono/duration.hpp"
27 #include "internal/geode_globals.hpp"
28 
33 namespace apache {
34 namespace geode {
35 namespace client {
36 
37 class CacheImpl;
38 class PoolAttributes;
39 class Pool;
40 
68 class APACHE_GEODE_EXPORT PoolFactory {
69  public:
75  static const std::chrono::milliseconds DEFAULT_FREE_CONNECTION_TIMEOUT;
76 
83  static const std::chrono::milliseconds DEFAULT_LOAD_CONDITIONING_INTERVAL;
84 
90  static const int DEFAULT_SOCKET_BUFFER_SIZE = 32768;
91 
96  static const std::chrono::milliseconds DEFAULT_READ_TIMEOUT;
97 
102  static const int DEFAULT_MIN_CONNECTIONS = 1;
103 
108  static const int DEFAULT_MAX_CONNECTIONS = -1;
109 
114  static const std::chrono::milliseconds DEFAULT_IDLE_TIMEOUT;
115 
121  static const int DEFAULT_RETRY_ATTEMPTS = -1;
122 
127  static const std::chrono::milliseconds DEFAULT_PING_INTERVAL;
128 
133  static const std::chrono::milliseconds DEFAULT_UPDATE_LOCATOR_LIST_INTERVAL;
134 
140  static const std::chrono::milliseconds DEFAULT_STATISTIC_INTERVAL;
141 
146  static const bool DEFAULT_SUBSCRIPTION_ENABLED = false;
147 
154  static const int DEFAULT_SUBSCRIPTION_REDUNDANCY = 0;
155 
161  static const std::chrono::milliseconds
163 
169  static const std::chrono::milliseconds DEFAULT_SUBSCRIPTION_ACK_INTERVAL;
170 
175  static const std::string DEFAULT_SERVER_GROUP;
180  static constexpr bool DEFAULT_THREAD_LOCAL_CONN = false;
181 
186  static constexpr bool DEFAULT_MULTIUSER_SECURE_MODE = false;
187 
192  static constexpr bool DEFAULT_PR_SINGLE_HOP_ENABLED = true;
193 
211  PoolFactory& setFreeConnectionTimeout(
212  std::chrono::milliseconds connectionTimeout);
213 
228  PoolFactory& setLoadConditioningInterval(
229  std::chrono::milliseconds loadConditioningInterval);
230 
244  PoolFactory& setSocketBufferSize(int bufferSize);
245 
264  PoolFactory& setThreadLocalConnections(bool threadLocalConnections);
265 
276  PoolFactory& setReadTimeout(std::chrono::milliseconds timeout);
277 
291  PoolFactory& setMinConnections(int minConnections);
292 
309  PoolFactory& setMaxConnections(int maxConnections);
310 
323  PoolFactory& setIdleTimeout(std::chrono::milliseconds);
324 
334  PoolFactory& setRetryAttempts(int retryAttempts);
335 
354  PoolFactory& setPingInterval(std::chrono::milliseconds pingInterval);
355 
364  PoolFactory& setUpdateLocatorListInterval(
365  std::chrono::milliseconds updateLocatorListInterval);
366 
380  PoolFactory& setStatisticInterval(
381  std::chrono::milliseconds statisticInterval);
382 
391  PoolFactory& setServerGroup(std::string group);
392 
410  PoolFactory& addLocator(const std::string& host, int port);
411 
427  PoolFactory& addServer(const std::string& host, int port);
428 
437  PoolFactory& setSubscriptionEnabled(bool enabled);
438 
452  PoolFactory& setSubscriptionRedundancy(int redundancy);
453 
467  PoolFactory& setSubscriptionMessageTrackingTimeout(
468  std::chrono::milliseconds messageTrackingTimeout);
469 
481  PoolFactory& setSubscriptionAckInterval(
482  std::chrono::milliseconds ackInterval);
483 
491  PoolFactory& setMultiuserAuthentication(bool multiuserAuthentication);
492 
497  PoolFactory& reset();
498 
510  std::shared_ptr<Pool> create(std::string name);
511 
532  PoolFactory& setPRSingleHopEnabled(bool enabled);
533 
534  ~PoolFactory() = default;
535 
536  PoolFactory(const PoolFactory&) = default;
537 
538  private:
539  explicit PoolFactory(const Cache& cache);
540  PoolFactory& addCheck(const std::string& host, int port);
541  std::shared_ptr<PoolAttributes> m_attrs;
542  bool m_isSubscriptionRedundancy;
543  bool m_addedServerOrLocator;
544  const Cache& m_cache;
545 
546  friend class Cache;
547  friend class PoolManager;
548  friend class PoolManagerImpl;
549  friend class CacheFactory;
550  friend class CacheXmlCreation;
551 };
552 
553 } // namespace client
554 } // namespace geode
555 } // namespace apache
556 
557 #endif // GEODE_POOLFACTORY_H_
apache::geode::client::PoolFactory::DEFAULT_STATISTIC_INTERVAL
static const std::chrono::milliseconds DEFAULT_STATISTIC_INTERVAL
The default frequency that client statistics are sent to the server.
Definition: PoolFactory.hpp:140
apache::geode::client::PoolManager
Manages creation and access to connection pools for clients.
Definition: PoolManager.hpp:61
apache::geode::client::PoolFactory::DEFAULT_FREE_CONNECTION_TIMEOUT
static const std::chrono::milliseconds DEFAULT_FREE_CONNECTION_TIMEOUT
The default amount of time which we will wait for a free connection if max connections is set and all...
Definition: PoolFactory.hpp:75
apache::geode::client::PoolFactory::DEFAULT_SUBSCRIPTION_MESSAGE_TRACKING_TIMEOUT
static const std::chrono::milliseconds DEFAULT_SUBSCRIPTION_MESSAGE_TRACKING_TIMEOUT
The default amount of time that messages sent from a server to a client will be tracked.
Definition: PoolFactory.hpp:162
apache::geode::client::PoolFactory::DEFAULT_PING_INTERVAL
static const std::chrono::milliseconds DEFAULT_PING_INTERVAL
The default frequency, to ping servers.
Definition: PoolFactory.hpp:127
apache::geode::client::Cache
Definition: Cache.hpp:67
apache::geode::client::PoolFactory::DEFAULT_READ_TIMEOUT
static const std::chrono::milliseconds DEFAULT_READ_TIMEOUT
The default amount of time to wait for a response from a server.
Definition: PoolFactory.hpp:96
apache::geode::client::PoolFactory::DEFAULT_UPDATE_LOCATOR_LIST_INTERVAL
static const std::chrono::milliseconds DEFAULT_UPDATE_LOCATOR_LIST_INTERVAL
The default frequency to update the locator list.
Definition: PoolFactory.hpp:133
apache::geode::client::PoolFactory::DEFAULT_LOAD_CONDITIONING_INTERVAL
static const std::chrono::milliseconds DEFAULT_LOAD_CONDITIONING_INTERVAL
The default interval in which the pool will check to see if a connection to a given server should be ...
Definition: PoolFactory.hpp:83
apache::geode::client::PoolFactory::DEFAULT_SUBSCRIPTION_ACK_INTERVAL
static const std::chrono::milliseconds DEFAULT_SUBSCRIPTION_ACK_INTERVAL
The default amount of time to wait before sending an acknowledgement to the server about events recei...
Definition: PoolFactory.hpp:169
apache::geode::client::PoolFactory
This interface provides for the configuration and creation of instances of Pool.
Definition: PoolFactory.hpp:68
Pool.hpp
apache::geode::client::PoolFactory::DEFAULT_IDLE_TIMEOUT
static const std::chrono::milliseconds DEFAULT_IDLE_TIMEOUT
The default amount of time to wait for a connection to become idle.
Definition: PoolFactory.hpp:114
apache::geode::client::CacheFactory
Definition: CacheFactory.hpp:48
apache::geode::client::PoolFactory::DEFAULT_SERVER_GROUP
static const std::string DEFAULT_SERVER_GROUP
The default server group.
Definition: PoolFactory.hpp:175

Apache Geode C++ Cache API Documentation