VMware Tanzu GemFire Native C++ Reference  10.1.5
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 
212  std::chrono::milliseconds connectionTimeout);
213 
229  std::chrono::milliseconds loadConditioningInterval);
230 
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 
365  std::chrono::milliseconds updateLocatorListInterval);
366 
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 
438 
453 
468  std::chrono::milliseconds messageTrackingTimeout);
469 
482  std::chrono::milliseconds ackInterval);
483 
491  PoolFactory& setMultiuserAuthentication(bool multiuserAuthentication);
492 
498 
510  std::shared_ptr<Pool> create(std::string name);
511 
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::PoolFactory::setLoadConditioningInterval
PoolFactory & setLoadConditioningInterval(std::chrono::milliseconds loadConditioningInterval)
Sets the load conditioning interval for this pool.
apache::geode::client::PoolFactory::setUpdateLocatorListInterval
PoolFactory & setUpdateLocatorListInterval(std::chrono::milliseconds updateLocatorListInterval)
The frequency with which client updates the locator list.
apache::geode::client::PoolFactory::setPingInterval
PoolFactory & setPingInterval(std::chrono::milliseconds pingInterval)
The frequency with which servers must be pinged to verify that they are still alive.
apache::geode::client::PoolManager
Manages creation and access to connection pools for clients.
Definition: PoolManager.hpp:61
apache::geode::client::PoolFactory::setIdleTimeout
PoolFactory & setIdleTimeout(std::chrono::milliseconds)
Sets the amount of time a connection can be idle before expiring the connection.
apache::geode::client::PoolFactory::setReadTimeout
PoolFactory & setReadTimeout(std::chrono::milliseconds timeout)
Sets the duration to wait for a response from a server before timing out the operation and trying ano...
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::setSubscriptionEnabled
PoolFactory & setSubscriptionEnabled(bool enabled)
If set to true then the created pool will have server-to-client subscriptions enabled.
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::setSubscriptionAckInterval
PoolFactory & setSubscriptionAckInterval(std::chrono::milliseconds ackInterval)
Sets the is the interval to wait before sending acknowledgements to the bridge server for events rece...
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::PoolFactory::setMultiuserAuthentication
PoolFactory & setMultiuserAuthentication(bool multiuserAuthentication)
Sets whether Pool is in multi user secure mode.
apache::geode::client::Cache
Caches are obtained from the create method on the CacheFactory#create class.
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::reset
PoolFactory & reset()
Resets the configuration of this factory to its defaults.
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::setThreadLocalConnections
PoolFactory & setThreadLocalConnections(bool threadLocalConnections)
Sets the thread local connections policy for this pool.
apache::geode::client::PoolFactory::setMinConnections
PoolFactory & setMinConnections(int minConnections)
Sets the minimum number of connections to keep available at all times.
apache::geode::client::PoolFactory::setSubscriptionRedundancy
PoolFactory & setSubscriptionRedundancy(int redundancy)
Sets the redundancy level for this pools server-to-client subscriptions.
apache::geode::client::PoolFactory::setRetryAttempts
PoolFactory & setRetryAttempts(int retryAttempts)
Set the number of times to retry a request after timeout/exception.
apache::geode::client::PoolFactory::setSocketBufferSize
PoolFactory & setSocketBufferSize(int bufferSize)
Sets the socket buffer size for each connection made in this pool.
apache::geode::client::PoolFactory::setPRSingleHopEnabled
PoolFactory & setPRSingleHopEnabled(bool enabled)
By default setPRSingleHopEnabled is true.
apache::geode::client::PoolFactory::create
std::shared_ptr< Pool > create(std::string name)
Creates a new Pool for connecting a client to a set of Geode Cache Servers.
apache::geode::client::PoolFactory::setServerGroup
PoolFactory & setServerGroup(std::string group)
Configures the group which contains all the servers that this pool connects to.
apache::geode::client::PoolFactory::setStatisticInterval
PoolFactory & setStatisticInterval(std::chrono::milliseconds statisticInterval)
The frequency with which the client statistics must be sent to the server.
apache::geode::client::PoolFactory::setMaxConnections
PoolFactory & setMaxConnections(int maxConnections)
Sets the max number of client to server connections that the pool will create.
apache::geode::client::PoolFactory::addLocator
PoolFactory & addLocator(const std::string &host, int port)
Adds a locator, given its host and port, to this factory.
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
Top level class for configuring and using Geode on a client.This should be called once to create Cach...
Definition: CacheFactory.hpp:48
apache::geode::client::PoolFactory::setSubscriptionMessageTrackingTimeout
PoolFactory & setSubscriptionMessageTrackingTimeout(std::chrono::milliseconds messageTrackingTimeout)
Sets the messageTrackingTimeout attribute which is the time-to-live period for subscription events th...
apache::geode::client::PoolFactory::addServer
PoolFactory & addServer(const std::string &host, int port)
Adds a server, given its host and port, to this factory.
apache::geode::client::PoolFactory::DEFAULT_SERVER_GROUP
static const std::string DEFAULT_SERVER_GROUP
The default server group.
Definition: PoolFactory.hpp:175
apache::geode::client::PoolFactory::setFreeConnectionTimeout
PoolFactory & setFreeConnectionTimeout(std::chrono::milliseconds connectionTimeout)
Sets the free connection timeout for this pool.

Apache Geode C++ Cache API Documentation