Hazelcast C++ Client
ClientProperties.h
1 /*
2  * Copyright (c) 2008-2018, 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(ClientConfig& config, const std::string& name, const std::string& defaultValue);
45 
46  std::string getName() const;
47 
48  std::string getValue() const;
49 
50  template <typename T>
51  T get() const {
52  return util::IOUtil::to_value<T>(value);
53  }
54 
55  int getInteger() const;
56 
57  byte getByte() const;
58 
59  bool getBoolean() const;
60 
61  int64_t getLong() const;
62 
63  const std::string &getDefaultValue() const;
64 
65  private:
66  std::string name;
67  std::string value;
68  std::string defaultValue;
69  };
70 
71 
77  class HAZELCAST_API ClientProperties {
78  public:
79  ClientProperties(ClientConfig& clientConfig);
80 
81  const ClientProperty& getHeartbeatTimeout() const;
82 
83  const ClientProperty& getHeartbeatInterval() const;
84 
85  const ClientProperty& getRetryCount() const;
86 
87  const ClientProperty& getRetryWaitTime() const;
88 
89  const ClientProperty& getAwsMemberPort() const;
90 
91  const ClientProperty &getCleanResourcesPeriodMillis() const;
92 
93  const ClientProperty &getInvocationRetryPauseMillis() const;
94 
95  const ClientProperty &getInvocationTimeoutSeconds() const;
96 
97  const ClientProperty &getEventThreadCount() const;
98 
99  const ClientProperty &getEventQueueCapacity() const;
100 
101  const ClientProperty &getInternalExecutorPoolSize() const;
102 
103  const ClientProperty &getShuffleMemberList() const;
104 
105  const ClientProperty &getMaxConcurrentInvocations() const;
106 
107  const ClientProperty &getBackpressureBackoffTimeoutMillis() const;
108 
117  static const std::string PROP_HEARTBEAT_TIMEOUT;
118  static const std::string PROP_HEARTBEAT_TIMEOUT_DEFAULT;
119 
126  static const std::string PROP_HEARTBEAT_INTERVAL;
127  static const std::string PROP_HEARTBEAT_INTERVAL_DEFAULT;
128 
138  static const std::string PROP_REQUEST_RETRY_COUNT;
139  static const std::string PROP_REQUEST_RETRY_COUNT_DEFAULT;
140 
150  static const std::string PROP_REQUEST_RETRY_WAIT_TIME;
151  static const std::string PROP_REQUEST_RETRY_WAIT_TIME_DEFAULT;
152 
158  static const std::string PROP_AWS_MEMBER_PORT;
159  static const std::string PROP_AWS_MEMBER_PORT_DEFAULT;
160 
164  static const std::string CLEAN_RESOURCES_PERIOD_MILLIS;
165  static const std::string CLEAN_RESOURCES_PERIOD_MILLIS_DEFAULT;
166 
170  static const std::string INVOCATION_RETRY_PAUSE_MILLIS;
171  static const std::string INVOCATION_RETRY_PAUSE_MILLIS_DEFAULT;
172 
183  static const std::string INVOCATION_TIMEOUT_SECONDS;
184  static const std::string INVOCATION_TIMEOUT_SECONDS_DEFAULT;
185 
189  static const std::string EVENT_THREAD_COUNT;
190  static const std::string EVENT_THREAD_COUNT_DEFAULT;
191 
195  static const std::string EVENT_QUEUE_CAPACITY;
196  static const std::string EVENT_QUEUE_CAPACITY_DEFAULT;
197 
198  static const std::string INTERNAL_EXECUTOR_POOL_SIZE;
199  static const std::string INTERNAL_EXECUTOR_POOL_SIZE_DEFAULT;
200 
206  static const std::string SHUFFLE_MEMBER_LIST;
207  static const std::string SHUFFLE_MEMBER_LIST_DEFAULT;
208 
218  static const std::string MAX_CONCURRENT_INVOCATIONS;
219  static const std::string MAX_CONCURRENT_INVOCATIONS_DEFAULT;
220 
232  static const std::string BACKPRESSURE_BACKOFF_TIMEOUT_MILLIS;
233  static const std::string BACKPRESSURE_BACKOFF_TIMEOUT_MILLIS_DEFAULT;
234 
235  private:
236  ClientProperty heartbeatTimeout;
237  ClientProperty heartbeatInterval;
238  ClientProperty retryCount;
239  ClientProperty retryWaitTime;
240  ClientProperty awsMemberPort;
241  ClientProperty cleanResourcesPeriod;
242  ClientProperty invocationRetryPauseMillis;
243  ClientProperty invocationTimeoutSeconds;
244  ClientProperty eventThreadCount;
245  ClientProperty eventQueueCapacity;
246  ClientProperty internalExecutorPoolSize;
247  ClientProperty shuffleMemberList;
248  ClientProperty maxConcurrentInvocations;
249  ClientProperty backpressureBackoffTimeoutMillis;
250  };
251 
252  }
253 }
254 
255 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
256 #pragma warning(pop)
257 #endif
258 
259 #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:138
static const std::string PROP_HEARTBEAT_TIMEOUT
Client will be sending heartbeat messages to members and this is the timeout.
Definition: ClientProperties.h:117
static const std::string PROP_AWS_MEMBER_PORT
The discovery mechanism will discover only IP addresses.
Definition: ClientProperties.h:158
static const std::string EVENT_THREAD_COUNT
Number of the threads to handle the incoming event packets.
Definition: ClientProperties.h:189
static const std::string PROP_HEARTBEAT_INTERVAL
Time interval in seconds between heartbeats to nodes from client.
Definition: ClientProperties.h:126
A client property is a configuration for hazelcast client.
Definition: ClientProperties.h:42
Client Properties is an internal class.
Definition: ClientProperties.h:77
static const std::string EVENT_QUEUE_CAPACITY
Capacity of the executor that handles the incoming event packets.
Definition: ClientProperties.h:195
static const std::string INVOCATION_TIMEOUT_SECONDS
When an invocation gets an exception because :
Definition: ClientProperties.h:183
static const std::string PROP_REQUEST_RETRY_WAIT_TIME
Client will retry requests which either inherently retryable(idempotent client) or ClientNetworkConfi...
Definition: ClientProperties.h:150
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:232
static const std::string MAX_CONCURRENT_INVOCATIONS
The maximum number of concurrent invocations allowed.
Definition: ClientProperties.h:218
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:206
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:170
static const std::string CLEAN_RESOURCES_PERIOD_MILLIS
The period in milliseconds at which the resource cleaning is run (e.g.
Definition: ClientProperties.h:164
HazelcastClient configuration class.
Definition: ClientConfig.h:55