VMware GemFire Native C++ Reference  9.1
SystemProperties.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #ifndef GEODE_SYSTEMPROPERTIES_H_
4 #define GEODE_SYSTEMPROPERTIES_H_
5 
6 /*
7  * Licensed to the Apache Software Foundation (ASF) under one or more
8  * contributor license agreements. See the NOTICE file distributed with
9  * this work for additional information regarding copyright ownership.
10  * The ASF licenses this file to You under the Apache License, Version 2.0
11  * (the "License"); you may not use this file except in compliance with
12  * the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22 
23 #include "Properties.hpp"
24 #include "Log.hpp"
25 #include "AuthInitialize.hpp"
26 
30 namespace apache {
31 namespace geode {
32 namespace client {
33 
40 // Factory function typedefs to register the managed authInitialize
41 typedef AuthInitialize* (*LibraryAuthInitializeFn)(const char* assemblyPath,
42  const char* factFuncName);
43 
51  public:
60  SystemProperties(const PropertiesPtr& propertiesPtr,
61  const char* configFile = NULL);
62 
67 
69  void logSettings();
70 
71  const uint32_t threadPoolSize() const { return m_threadPoolSize; }
72 
77  const uint32_t statisticsSampleInterval() const {
78  return m_statisticsSampleInterval;
79  }
80 
84  bool statisticsEnabled() const { return m_statisticsEnabled; }
85 
89  bool sslEnabled() const { return m_sslEnabled; }
90 
94  bool getEnableTimeStatistics() const /*timestatisticsEnabled()*/
95  {
96  return m_timestatisticsEnabled;
97  } /*m_timestatisticsEnabled*/
98 
102  const char* sslKeyStore() const { return m_sslKeyStore; }
103 
107  const char* sslKeystorePassword() const { return m_sslKeystorePassword; }
108 
112  const char* sslTrustStore() const { return m_sslTrustStore; }
113 
118  const char* statisticsArchiveFile() const { return m_statisticsArchiveFile; }
119 
124  const char* logFilename() const { return m_logFilename; }
125 
129  Log::LogLevel logLevel() const { return m_logLevel; }
130 
140  const bool heapLRULimitEnabled() const { return (m_heapLRULimit > 0); }
141 
149  const size_t heapLRULimit() const { return m_heapLRULimit; }
150 
156  const int32_t heapLRUDelta() const { return m_heapLRUDelta; }
160  const int32_t maxSocketBufferSize() const { return m_maxSocketBufferSize; }
161 
165  const int32_t pingInterval() const { return m_pingInterval; }
169  const int32_t redundancyMonitorInterval() const {
170  return m_redundancyMonitorInterval;
171  }
172 
176  const int32_t notifyAckInterval() const { return m_notifyAckInterval; }
177 
182  const int32_t notifyDupCheckLife() const { return m_notifyDupCheckLife; }
183 
187  const char* durableClientId() const { return m_durableClientId; }
188 
192  const uint32_t durableTimeout() const { return m_durableTimeout; }
193 
197  const uint32_t connectTimeout() const { return m_connectTimeout; }
198 
203  const uint32_t connectWaitTimeout() const { return m_connectWaitTimeout; }
204 
209  const uint32_t bucketWaitTimeout() const { return m_bucketWaitTimeout; }
210 
214  char* conflateEvents() { return m_conflateEvents; }
215 
219  const bool debugStackTraceEnabled() const { return m_debugStackTraceEnabled; }
220 
230  inline const bool crashDumpEnabled() const { return m_crashDumpEnabled; }
231 
232  const char* name() const { return m_name; }
233 
234  const char* cacheXMLFile() const { return m_cacheXMLFile; }
235 
239  const uint32_t logFileSizeLimit() const { return m_logFileSizeLimit; }
240 
244  const uint32_t logDiskSpaceLimit() const { return m_logDiskSpaceLimit; }
245 
249  const uint32_t statsFileSizeLimit() const { return m_statsFileSizeLimit; }
250 
254  const uint32_t statsDiskSpaceLimit() const { return m_statsDiskSpaceLimit; }
255 
256  const uint32_t maxQueueSize() { return m_maxQueueSize; }
257 
258  const uint32_t javaConnectionPoolSize() const {
259  return m_javaConnectionPoolSize;
260  }
261  void setjavaConnectionPoolSize(uint32_t size) {
262  m_javaConnectionPoolSize = size;
263  }
264 
269  bool disableChunkHandlerThread() const { return m_disableChunkHandlerThread; }
270 
274  bool readTimeoutUnitInMillis() const { return m_readTimeoutUnitInMillis; }
275 
281  m_disableChunkHandlerThread = set;
282  }
283 
289  return m_onClientDisconnectClearPdxTypeIds;
290  }
291 
297  m_onClientDisconnectClearPdxTypeIds = set;
298  }
299 
301  inline const char* authInitLibrary() const {
302  return (m_AuthIniLoaderLibrary == NULLPTR
303  ? ""
304  : m_AuthIniLoaderLibrary->asChar());
305  }
306 
308  inline const char* authInitFactory() const {
309  return (m_AuthIniLoaderFactory == NULLPTR
310  ? ""
311  : m_AuthIniLoaderFactory->asChar());
312  }
313 
315  const char* securityClientDhAlgo() {
316  return (m_securityClientDhAlgo == NULLPTR
317  ? ""
318  : m_securityClientDhAlgo->asChar());
319  }
320 
322  const char* securityClientKsPath() {
323  return (m_securityClientKsPath == NULLPTR
324  ? ""
325  : m_securityClientKsPath->asChar());
326  }
327 
332  return m_securityPropertiesPtr;
333  }
334 
338  inline bool isSecurityOn() const {
339  return (m_AuthIniLoaderFactory != NULLPTR &&
340  m_AuthIniLoaderLibrary != NULLPTR);
341  }
342 
346  inline bool isEndpointShufflingDisabled() const {
347  return m_disableShufflingEndpoint;
348  }
349 
354  bool isDhOn() {
355  return isSecurityOn() && m_securityClientDhAlgo != NULLPTR &&
356  m_securityClientDhAlgo->length() > 0;
357  }
358 
374  inline bool isGridClient() const { return m_gridClient; }
375 
381  inline bool isAppDomainEnabled() const { return m_appDomainEnabled; }
382 
392  inline bool autoReadyForEvents() const { return m_autoReadyForEvents; }
393 
397  const uint32_t suspendedTxTimeout() const { return m_suspendedTxTimeout; }
398 
402  const uint32_t tombstoneTimeoutInMSec() const {
403  return m_tombstoneTimeoutInMSec;
404  }
405 
406  private:
407  uint32_t m_statisticsSampleInterval;
408 
409  bool m_statisticsEnabled;
410 
411  bool m_appDomainEnabled;
412 
413  char* m_statisticsArchiveFile;
414 
415  char* m_logFilename;
416 
417  Log::LogLevel m_logLevel;
418 
419  int m_sessions;
420 
421  char* m_name;
422 
423  bool m_debugStackTraceEnabled;
424 
425  bool m_crashDumpEnabled;
426 
427  bool m_disableShufflingEndpoint;
428 
429  char* m_cacheXMLFile;
430 
431  uint32_t m_logFileSizeLimit;
432  uint32_t m_logDiskSpaceLimit;
433 
434  uint32_t m_statsFileSizeLimit;
435  uint32_t m_statsDiskSpaceLimit;
436 
437  uint32_t m_maxQueueSize;
438  uint32_t m_javaConnectionPoolSize;
439 
440  int32_t m_heapLRULimit;
441  int32_t m_heapLRUDelta;
442  int32_t m_maxSocketBufferSize;
443  int32_t m_pingInterval;
444  int32_t m_redundancyMonitorInterval;
445 
446  int32_t m_notifyAckInterval;
447  int32_t m_notifyDupCheckLife;
448 
449  PropertiesPtr m_securityPropertiesPtr;
450  CacheableStringPtr m_AuthIniLoaderLibrary;
451  CacheableStringPtr m_AuthIniLoaderFactory;
452  CacheableStringPtr m_securityClientDhAlgo;
453  CacheableStringPtr m_securityClientKsPath;
454  AuthInitializePtr m_authInitializer;
455 
456  char* m_durableClientId;
457  uint32_t m_durableTimeout;
458 
459  uint32_t m_connectTimeout;
460  uint32_t m_connectWaitTimeout;
461  uint32_t m_bucketWaitTimeout;
462 
463  bool m_gridClient;
464 
465  bool m_autoReadyForEvents;
466 
467  bool m_sslEnabled;
468  bool m_timestatisticsEnabled;
469  char* m_sslKeyStore;
470  char* m_sslTrustStore;
471 
472  char* m_sslKeystorePassword;
473 
474  char* m_conflateEvents;
475 
476  uint32_t m_threadPoolSize;
477  uint32_t m_suspendedTxTimeout;
478  uint32_t m_tombstoneTimeoutInMSec;
479  bool m_disableChunkHandlerThread;
480  bool m_readTimeoutUnitInMillis;
481  bool m_onClientDisconnectClearPdxTypeIds;
482 
483  private:
488  void processProperty(const char* property, const char* value);
489 
495  AuthInitializePtr getAuthLoader();
496 
497  private:
498  SystemProperties(const SystemProperties& rhs); // never defined
499  void operator=(const SystemProperties& rhs); // never defined
500 
501  void throwError(const char* msg);
502 
503  public:
504  static LibraryAuthInitializeFn managedAuthInitializeFn;
505 
506  friend class DistributedSystemImpl;
507 };
508 } // namespace client
509 } // namespace geode
510 } // namespace apache
511 
512 #endif // GEODE_SYSTEMPROPERTIES_H_
void setDisableChunkHandlerThread(bool set)
This can be call multiple time to disable chunkhandler thread for those operations.
Definition: SystemProperties.hpp:280
A class for internal use, that encapsulates the properties that can be set from DistributedSystem::co...
Definition: SystemProperties.hpp:50
void setOnClientDisconnectClearPdxTypeIds(bool set)
Set to true if app want to clear pdx type ids when client disconnect.
Definition: SystemProperties.hpp:296
const int32_t notifyAckInterval() const
Returns the periodic notify ack interval.
Definition: SystemProperties.hpp:176
bool isEndpointShufflingDisabled() const
Checks whether list of endpoint is shuffeled or not.
Definition: SystemProperties.hpp:346
const bool heapLRULimitEnabled() const
Returns a boolean that specifies if heapLRULimit has been enabled for the process.
Definition: SystemProperties.hpp:140
const bool debugStackTraceEnabled() const
Returns true if the stack trace is enabled ,false otherwise.
Definition: SystemProperties.hpp:219
const char * authInitFactory() const
Return the security auth factory.
Definition: SystemProperties.hpp:308
Each enum represents a predefined RegionAttributes in a Cache.
Definition: Assert.hpp:31
PropertiesPtr getSecurityProperties() const
Returns securityPropertiesPtr.
Definition: SystemProperties.hpp:331
bool getEnableTimeStatistics() const
Whether time stats are enabled for the statistics.
Definition: SystemProperties.hpp:94
const char * sslKeyStore() const
Returns the path of the private key file for SSL use.
Definition: SystemProperties.hpp:102
const int32_t pingInterval() const
Returns the time between two consecutive ping to servers.
Definition: SystemProperties.hpp:165
#define CPPCACHE_EXPORT
Defines a Geode CPPCACHE export.
Definition: geode_base.hpp:58
const uint32_t bucketWaitTimeout() const
Returns the connect wait timeout(in millis) used for to connect to server This is only applicable for...
Definition: SystemProperties.hpp:209
bool isDhOn()
Check whether Diffie-Hellman based credentials encryption is on.
Definition: SystemProperties.hpp:354
const uint32_t connectWaitTimeout() const
Returns the connect wait timeout(in millis) used for to connect to server This is only applicable for...
Definition: SystemProperties.hpp:203
const uint32_t statisticsSampleInterval() const
Returns the sampling interval of the sampling thread.
Definition: SystemProperties.hpp:77
const int32_t heapLRUDelta() const
Returns the HeapLRUDelta value (a percent value).
Definition: SystemProperties.hpp:156
const uint32_t connectTimeout() const
Returns the connect timeout used for server and locator handshakes.
Definition: SystemProperties.hpp:197
bool readTimeoutUnitInMillis() const
This can be call to know whether read timeout unit is in milli second.
Definition: SystemProperties.hpp:274
const int32_t maxSocketBufferSize() const
Returns the maximum socket buffer size to use.
Definition: SystemProperties.hpp:160
Log::LogLevel logLevel() const
Returns the log level at which logging would be done.
Definition: SystemProperties.hpp:129
bool isSecurityOn() const
Checks whether Security is on or off.
Definition: SystemProperties.hpp:338
const char * statisticsArchiveFile() const
Returns the name of the filename into which statistics would be archived.
Definition: SystemProperties.hpp:118
const char * durableClientId() const
Returns the durable client ID.
Definition: SystemProperties.hpp:187
bool disableChunkHandlerThread() const
This can be call to know whether chunkhandler thread is disable for that opertaion.
Definition: SystemProperties.hpp:269
const uint32_t tombstoneTimeoutInMSec() const
Returns the tombstone timeout .
Definition: SystemProperties.hpp:402
bool isGridClient() const
Checks to see if this native client is being invoked as part of small grid jobs; use this setting to ...
Definition: SystemProperties.hpp:374
AuthInitialize *(* LibraryAuthInitializeFn)(const char *assemblyPath, const char *factFuncName)
The SystemProperties class.
Definition: SystemProperties.hpp:41
const size_t heapLRULimit() const
Returns the HeapLRULimit value (in bytes), the maximum memory that values in a cache can use to store...
Definition: SystemProperties.hpp:149
const uint32_t logDiskSpaceLimit() const
Returns the log-disk-space-limit.
Definition: SystemProperties.hpp:244
bool isAppDomainEnabled() const
This property checks whether C# client is running in multiple appdoamin or not.
Definition: SystemProperties.hpp:381
Specifies the mechanism to obtain credentials for a client.
Definition: AuthInitialize.hpp:45
const char * logFilename() const
Returns the name of the filename into which logging would be done.
Definition: SystemProperties.hpp:124
const uint32_t statsFileSizeLimit() const
Returns the stat-file-space-limit.
Definition: SystemProperties.hpp:249
char * conflateEvents()
Returns client Queueconflation option.
Definition: SystemProperties.hpp:214
const uint32_t durableTimeout() const
Returns the durable timeout.
Definition: SystemProperties.hpp:192
bool onClientDisconnectClearPdxTypeIds() const
returns true if app want to clear pdx type ids when client disconnect.
Definition: SystemProperties.hpp:288
bool autoReadyForEvents() const
Whether a non durable client starts to receive and process subscription events automatically.
Definition: SystemProperties.hpp:392
const uint32_t statsDiskSpaceLimit() const
Returns the stat-disk-size-limit.
Definition: SystemProperties.hpp:254
const int32_t notifyDupCheckLife() const
Returns the expiry time of an idle event id map entry for duplicate notification checking.
Definition: SystemProperties.hpp:182
bool sslEnabled() const
Whether SSL is enabled for socket connections.
Definition: SystemProperties.hpp:89
const char * sslKeystorePassword() const
Returns the client keystore password.
Definition: SystemProperties.hpp:107
const uint32_t suspendedTxTimeout() const
Returns the timeout after which suspended transactions are rolled back.
Definition: SystemProperties.hpp:397
const char * securityClientKsPath()
Return the keystore (.pem file ) path.
Definition: SystemProperties.hpp:322
const char * securityClientDhAlgo()
Return the security diffie hellman secret key algo.
Definition: SystemProperties.hpp:315
const uint32_t logFileSizeLimit() const
Returns the log-file-size-limit.
Definition: SystemProperties.hpp:239
const bool crashDumpEnabled() const
Returns true if crash dump generation for unhandled fatal errors is enabled, false otherwise...
Definition: SystemProperties.hpp:230
This namespace contains all the Geode C++ API classes, enumerations and globals.
const char * sslTrustStore() const
Returns the path of the public key file for SSL use.
Definition: SystemProperties.hpp:112
const int32_t redundancyMonitorInterval() const
Returns the time between two consecutive checks for redundancy for HA.
Definition: SystemProperties.hpp:169
const char * authInitLibrary() const
Return the security auth library.
Definition: SystemProperties.hpp:301
bool statisticsEnabled() const
Tells whether statistics needs to be archived or not.
Definition: SystemProperties.hpp:84

Pivotal GemFire C++ Cache API Documentation