Hazelcast C++ Client
ClientProperties.h
1 /*
2  * Copyright (c) 2008-2019, Hazelcast, Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 //
17 // Created by sancar koyunlu on 21/08/14.
18 //
19 
20 #ifndef HAZELCAST_ClientProperties
21 #define HAZELCAST_ClientProperties
22 
23 #include <string>
24 
25 #include "hazelcast/util/HazelcastDll.h"
26 #include "hazelcast/util/IOUtil.h"
27 
28 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
29 #pragma warning(push)
30 #pragma warning(disable: 4251) //for dll export
31 #endif
32 
33 namespace hazelcast {
34  namespace client {
35  class ClientConfig;
36 
42  class HAZELCAST_API ClientProperty {
43  public:
44  ClientProperty(const std::string &name, const std::string &defaultValue);
45 
46  const std::string &getName() const;
47 
48  const std::string &getDefaultValue() const;
49 
55  const char *getSystemProperty() const;
56 
57  private:
58  std::string name;
59  std::string defaultValue;
60  };
61 
62 
68  class HAZELCAST_API ClientProperties {
69  public:
70  ClientProperties(const std::map<std::string, std::string> &properties);
71 
72  const ClientProperty& getHeartbeatTimeout() const;
73 
74  const ClientProperty& getHeartbeatInterval() const;
75 
76  const ClientProperty& getAwsMemberPort() const;
77 
78  const ClientProperty &getCleanResourcesPeriodMillis() const;
79 
80  const ClientProperty &getInvocationRetryPauseMillis() const;
81 
82  const ClientProperty &getInvocationTimeoutSeconds() const;
83 
84  const ClientProperty &getEventThreadCount() const;
85 
86  const ClientProperty &getEventQueueCapacity() const;
87 
88  const ClientProperty &getInternalExecutorPoolSize() const;
89 
90  const ClientProperty &getShuffleMemberList() const;
91 
92  const ClientProperty &getMaxConcurrentInvocations() const;
93 
94  const ClientProperty &getBackpressureBackoffTimeoutMillis() const;
95 
96  const ClientProperty &getStatisticsEnabled() const;
97 
98  const ClientProperty &getStatisticsPeriodSeconds() const;
99 
108  static const std::string PROP_HEARTBEAT_TIMEOUT;
109  static const std::string PROP_HEARTBEAT_TIMEOUT_DEFAULT;
110 
117  static const std::string PROP_HEARTBEAT_INTERVAL;
118  static const std::string PROP_HEARTBEAT_INTERVAL_DEFAULT;
119 
129  static const std::string PROP_REQUEST_RETRY_COUNT;
130  static const std::string PROP_REQUEST_RETRY_COUNT_DEFAULT;
131 
141  static const std::string PROP_REQUEST_RETRY_WAIT_TIME;
142  static const std::string PROP_REQUEST_RETRY_WAIT_TIME_DEFAULT;
143 
149  static const std::string PROP_AWS_MEMBER_PORT;
150  static const std::string PROP_AWS_MEMBER_PORT_DEFAULT;
151 
155  static const std::string CLEAN_RESOURCES_PERIOD_MILLIS;
156  static const std::string CLEAN_RESOURCES_PERIOD_MILLIS_DEFAULT;
157 
161  static const std::string INVOCATION_RETRY_PAUSE_MILLIS;
162  static const std::string INVOCATION_RETRY_PAUSE_MILLIS_DEFAULT;
163 
174  static const std::string INVOCATION_TIMEOUT_SECONDS;
175  static const std::string INVOCATION_TIMEOUT_SECONDS_DEFAULT;
176 
180  static const std::string EVENT_THREAD_COUNT;
181  static const std::string EVENT_THREAD_COUNT_DEFAULT;
182 
186  static const std::string EVENT_QUEUE_CAPACITY;
187  static const std::string EVENT_QUEUE_CAPACITY_DEFAULT;
188 
189  static const std::string INTERNAL_EXECUTOR_POOL_SIZE;
190  static const std::string INTERNAL_EXECUTOR_POOL_SIZE_DEFAULT;
191 
197  static const std::string SHUFFLE_MEMBER_LIST;
198  static const std::string SHUFFLE_MEMBER_LIST_DEFAULT;
199 
209  static const std::string MAX_CONCURRENT_INVOCATIONS;
210  static const std::string MAX_CONCURRENT_INVOCATIONS_DEFAULT;
211 
223  static const std::string BACKPRESSURE_BACKOFF_TIMEOUT_MILLIS;
224  static const std::string BACKPRESSURE_BACKOFF_TIMEOUT_MILLIS_DEFAULT;
225 
231  static const std::string STATISTICS_ENABLED;
232  static const std::string STATISTICS_ENABLED_DEFAULT;
233 
237  static const std::string STATISTICS_PERIOD_SECONDS;
238  static const std::string STATISTICS_PERIOD_SECONDS_DEFAULT;
239 
246  bool getBoolean(const ClientProperty &property) const;
247 
254  int32_t getInteger(const ClientProperty &property) const;
255 
262  int64_t getLong(const ClientProperty &property) const;
263 
270  std::string getString(const ClientProperty &property) const;
271 
272  private:
273  ClientProperty heartbeatTimeout;
274  ClientProperty heartbeatInterval;
275  ClientProperty retryCount;
276  ClientProperty retryWaitTime;
277  ClientProperty awsMemberPort;
278  ClientProperty cleanResourcesPeriod;
279  ClientProperty invocationRetryPauseMillis;
280  ClientProperty invocationTimeoutSeconds;
281  ClientProperty eventThreadCount;
282  ClientProperty eventQueueCapacity;
283  ClientProperty internalExecutorPoolSize;
284  ClientProperty shuffleMemberList;
285  ClientProperty maxConcurrentInvocations;
286  ClientProperty backpressureBackoffTimeoutMillis;
287  ClientProperty statisticsEnabled;
288  ClientProperty statisticsPeriodSeconds;
289 
290  std::map<std::string, std::string> propertiesMap;
291  };
292 
293  }
294 }
295 
296 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
297 #pragma warning(pop)
298 #endif
299 
300 #endif //HAZELCAST_ClientProperties
static const std::string PROP_REQUEST_RETRY_COUNT
Client will retry requests which either inherently retryable(idempotent client) or ClientNetworkConfi...
Definition: ClientProperties.h:129
static const std::string PROP_HEARTBEAT_TIMEOUT
Client will be sending heartbeat messages to members and this is the timeout.
Definition: ClientProperties.h:108
static const std::string PROP_AWS_MEMBER_PORT
The discovery mechanism will discover only IP addresses.
Definition: ClientProperties.h:149
static const std::string STATISTICS_PERIOD_SECONDS
The period in seconds the statistics sent to the cluster.
Definition: ClientProperties.h:237
static const std::string EVENT_THREAD_COUNT
Number of the threads to handle the incoming event packets.
Definition: ClientProperties.h:180
static const std::string STATISTICS_ENABLED
Use to enable the client statistics collection.
Definition: ClientProperties.h:231
static const std::string PROP_HEARTBEAT_INTERVAL
Time interval in seconds between heartbeats to nodes from client.
Definition: ClientProperties.h:117
A client property is a configuration for hazelcast client.
Definition: ClientProperties.h:42
Client Properties is an internal class.
Definition: ClientProperties.h:68
static const std::string EVENT_QUEUE_CAPACITY
Capacity of the executor that handles the incoming event packets.
Definition: ClientProperties.h:186
static const std::string INVOCATION_TIMEOUT_SECONDS
When an invocation gets an exception because :
Definition: ClientProperties.h:174
static const std::string PROP_REQUEST_RETRY_WAIT_TIME
Client will retry requests which either inherently retryable(idempotent client) or ClientNetworkConfi...
Definition: ClientProperties.h:141
static const std::string BACKPRESSURE_BACKOFF_TIMEOUT_MILLIS
Control the maximum timeout in millis to wait for an invocation space to be available.
Definition: ClientProperties.h:223
static const std::string MAX_CONCURRENT_INVOCATIONS
The maximum number of concurrent invocations allowed.
Definition: ClientProperties.h:209
static const std::string SHUFFLE_MEMBER_LIST
Client shuffles the given member list to prevent all clients to connect to the same node when this pr...
Definition: ClientProperties.h:197
PN (Positive-Negative) CRDT counter.
Definition: MapEntryView.h:32
static const std::string INVOCATION_RETRY_PAUSE_MILLIS
Pause time between each retry cycle of an invocation in milliseconds.
Definition: ClientProperties.h:161
static const std::string CLEAN_RESOURCES_PERIOD_MILLIS
The period in milliseconds at which the resource cleaning is run (e.g.
Definition: ClientProperties.h:155