VMware GemFire Native C++ Reference
9.1
|
Top level class for configuring and using Geode on a client.This should be called once to create Cache. More...
Inherits apache::geode::client::SharedBase.
Public Member Functions | |
CacheFactoryPtr | addLocator (const char *host, int port) |
Adds a locator, given its host and port, to this factory. More... | |
CacheFactoryPtr | addServer (const char *host, int port) |
Adds a server, given its host and port, to this factory. More... | |
CachePtr | create () |
To create the instance of Cache. More... | |
void | preserveSB () const |
Atomically increment reference count. More... | |
int32_t | refCount () |
void | releaseSB () const |
Atomically decrement reference count, the SharedBase object is automatically deleted when its reference count goes to zero. More... | |
CacheFactoryPtr | set (const char *name, const char *value) |
Sets a geode property that will be used when creating the {link }. More... | |
CacheFactoryPtr | setFreeConnectionTimeout (int connectionTimeout) |
Sets the free connection timeout for this pool. More... | |
CacheFactoryPtr | setIdleTimeout (long idleTimeout) |
Sets the amount of time a connection can be idle before expiring the connection. More... | |
CacheFactoryPtr | setLoadConditioningInterval (int loadConditioningInterval) |
Sets the load conditioning interval for this pool. More... | |
CacheFactoryPtr | setMaxConnections (int maxConnections) |
Sets the max number of client to server connections that the pool will create. More... | |
CacheFactoryPtr | setMinConnections (int minConnections) |
Sets the minimum number of connections to keep available at all times. More... | |
CacheFactoryPtr | setMultiuserAuthentication (bool multiuserAuthentication) |
Sets whether Pool is in multi user secure mode. More... | |
CacheFactoryPtr | setPdxIgnoreUnreadFields (bool ignore) |
Control whether pdx ignores fields that were unread during deserialization. More... | |
CacheFactoryPtr | setPdxReadSerialized (bool pdxReadSerialized) |
Sets the object preference to PdxInstance type. More... | |
CacheFactoryPtr | setPingInterval (long pingInterval) |
The frequency with which servers must be pinged to verify that they are still alive. More... | |
CacheFactoryPtr | setPRSingleHopEnabled (bool enabled) |
By default setPRSingleHopEnabled is true The client is aware of location of partitions on servers hosting Regions. More... | |
CacheFactoryPtr | setReadTimeout (int timeout) |
Sets the number of milliseconds to wait for a response from a server before timing out the operation and trying another server (if any are available). More... | |
CacheFactoryPtr | setRetryAttempts (int retryAttempts) |
Set the number of times to retry a request after timeout/exception. More... | |
CacheFactoryPtr | setServerGroup (const char *group) |
Configures the group which contains all the servers that this pool connects to. More... | |
CacheFactoryPtr | setSocketBufferSize (int bufferSize) |
Sets the socket buffer size for each connection made in this pool. More... | |
CacheFactoryPtr | setStatisticInterval (int statisticInterval) |
The frequency with which the client statistics must be sent to the server. More... | |
CacheFactoryPtr | setSubscriptionAckInterval (int ackInterval) |
Sets the is the interval in milliseconds to wait before sending acknowledgements to the bridge server for events received from the server subscriptions. More... | |
CacheFactoryPtr | setSubscriptionEnabled (bool enabled) |
If set to true then the created pool will have server-to-client subscriptions enabled. More... | |
CacheFactoryPtr | setSubscriptionMessageTrackingTimeout (int messageTrackingTimeout) |
Sets the messageTrackingTimeout attribute which is the time-to-live period, in milliseconds, for subscription events the client has received from the server. More... | |
CacheFactoryPtr | setSubscriptionRedundancy (int redundancy) |
Sets the redundancy level for this pools server-to-client subscriptions. More... | |
CacheFactoryPtr | setThreadLocalConnections (bool threadLocalConnections) |
Sets the thread local connections policy for this pool. More... | |
CacheFactoryPtr | setUpdateLocatorListInterval (long updateLocatorListInterval) |
The frequency with which client updates the locator list. More... | |
Static Public Member Functions | |
static CacheFactoryPtr | createCacheFactory (const PropertiesPtr &dsProps=::apache::geode::client::NullSharedBase::s_instancePtr) |
To create the instance of CacheFactory. More... | |
static CachePtr | getAnyInstance () |
Gets an arbitrary open instance of Cache produced by an earlier call to CacheFactory::create. More... | |
static CachePtr | getInstance (const DistributedSystemPtr &system) |
Gets the instance of Cache produced by an earlier call to CacheFactory::create. More... | |
static CachePtr | getInstanceCloseOk (const DistributedSystemPtr &system) |
Gets the instance of Cache produced by an earlier call to CacheFactory::create, even if it has been closed. More... | |
static const char * | getProductDescription () |
Returns the product description string including product name and version. More... | |
static const char * | getVersion () |
Returns the version of the cache implementation. More... | |
Top level class for configuring and using Geode on a client.This should be called once to create Cache.
For the default values for the pool attributes see PoolFactory. To create additional Pools see PoolManager
CacheFactoryPtr apache::geode::client::CacheFactory::addLocator | ( | const char * | host, |
int | port | ||
) |
Adds a locator, given its host and port, to this factory.
The locator must be a server locator and will be used to discover other running bridge servers and locators.
host | is the host name or ip address that the locator is listening on. |
port | is the port that the locator is listening on. |
this
IllegalArgumentException | if the host is an unknown host according to java.net.InetAddress#getByName or if the port is outside the valid range of [1..65535] inclusive. |
IllegalStateException | if the locator has already been added to this factory. |
CacheFactoryPtr apache::geode::client::CacheFactory::addServer | ( | const char * | host, |
int | port | ||
) |
Adds a server, given its host and port, to this factory.
The server must be a bridge server and this client will directly connect to the server without consulting a server locator.
host | is the host name or ip address that the server is listening on. |
port | is the port that the server is listening on. |
this
IllegalArgumentException | if the host is an unknown host according to java.net.InetAddress#getByName or if the port is outside the valid range of [1..65535] inclusive. |
IllegalStateException | if the server has already been added to this factory. |
|
static |
To create the instance of CacheFactory.
dsProps | Properties which are applicable at client level. |
|
static |
Gets an arbitrary open instance of Cache produced by an earlier call to CacheFactory::create.
CacheClosedException | if a cache has not been created or the only created one is closed |
|
static |
Gets the instance of Cache produced by an earlier call to CacheFactory::create.
system | the DistributedSystem the cache was created with. |
CacheClosedException | if a cache has not been created or the created one is closed |
EntryNotFoundException | if a cache with specified system not found |
|
static |
Gets the instance of Cache produced by an earlier call to CacheFactory::create, even if it has been closed.
system | the DistributedSystem the cache was created with. |
CacheClosedException | if a cache has not been created |
EntryNotFoundException | if a cache with specified system is not found |
|
static |
Returns the product description string including product name and version.
|
static |
Returns the version of the cache implementation.
For the 1.0 release of Geode, the string returned is 1.0
.
String
|
inherited |
Atomically increment reference count.
|
inlineinherited |
|
inherited |
Atomically decrement reference count, the SharedBase object is automatically deleted when its reference count goes to zero.
CacheFactoryPtr apache::geode::client::CacheFactory::set | ( | const char * | name, |
const char * | value | ||
) |
Sets a geode property that will be used when creating the {link }.
name | the name of the geode property |
value | the value of the geode property |
this
CacheFactoryPtr apache::geode::client::CacheFactory::setFreeConnectionTimeout | ( | int | connectionTimeout | ) |
Sets the free connection timeout for this pool.
If the pool has a max connections setting, operations will block if all of the connections are in use. The free connection timeout specifies how long those operations will block waiting for a free connection before receiving an AllConnectionsInUseException. If max connections is not set this setting has no effect.
connectionTimeout | is the connection timeout in milliseconds |
this
IllegalArgumentException | if connectionTimeout is less than or equal to 0 . |
CacheFactoryPtr apache::geode::client::CacheFactory::setIdleTimeout | ( | long | idleTimeout | ) |
Sets the amount of time a connection can be idle before expiring the connection.
If the pool size is greater than the minimum specified by PoolFactory#setMinConnections(int), connections which have been idle for longer than the idleTimeout will be closed.
idleTimeout | is the amount of time in milliseconds that an idle connection should live before expiring. -1 indicates that connections should never expire. |
this
IllegalArgumentException | if idleTimout is less than 0 . |
CacheFactoryPtr apache::geode::client::CacheFactory::setLoadConditioningInterval | ( | int | loadConditioningInterval | ) |
Sets the load conditioning interval for this pool.
This interval controls how frequently the pool will check to see if a connection to a given server should be moved to a different server to improve the load balance.
A value of -1
disables load conditioning
loadConditioningInterval | is the connection lifetime in milliseconds |
this
IllegalArgumentException | if connectionLifetime is less than -1 . |
CacheFactoryPtr apache::geode::client::CacheFactory::setMaxConnections | ( | int | maxConnections | ) |
Sets the max number of client to server connections that the pool will create.
If all of the connections are in use, an operation requiring a client to server connection will block until a connection is available.
maxConnections | is the maximum number of connections in the pool. -1 indicates that there is no maximum number of connections |
this
IllegalArgumentException | if maxConnections is less than minConnections . |
CacheFactoryPtr apache::geode::client::CacheFactory::setMinConnections | ( | int | minConnections | ) |
Sets the minimum number of connections to keep available at all times.
When the pool is created, it will create this many connections. If 0
then connections will not be made until an actual operation is done that requires client-to-server communication.
minConnections | is the initial number of connections this pool will create. |
this
IllegalArgumentException | if minConnections is less than 0 . |
CacheFactoryPtr apache::geode::client::CacheFactory::setMultiuserAuthentication | ( | bool | multiuserAuthentication | ) |
Sets whether Pool is in multi user secure mode.
If its in multiuser mode then app needs to get RegionService instance of Cache, to do the operations on cache. Deafult value is false.
multiuserAuthentication | to set the pool in multiuser mode. |
this
CacheFactoryPtr apache::geode::client::CacheFactory::setPdxIgnoreUnreadFields | ( | bool | ignore | ) |
Control whether pdx ignores fields that were unread during deserialization.
The default is to preserve unread fields be including their data during serialization. But if you configure the cache to ignore unread fields then their data will be lost during serialization.
You should only set this attribute to true
if you know this member will only be reading cache data. In this use case you do not need to pay the cost of preserving the unread fields since you will never be reserializing pdx data.
ignore | true if fields not read during pdx deserialization should be ignored; false , the default, if they should be preserved. |
CacheFactoryPtr apache::geode::client::CacheFactory::setPdxReadSerialized | ( | bool | pdxReadSerialized | ) |
Sets the object preference to PdxInstance type.
When a cached object that was serialized as a PDX is read from the cache a PdxInstance will be returned instead of the actual domain class. The PdxInstance is an interface that provides run time access to the fields of a PDX without deserializing the entire PDX. The PdxInstance implementation is a light weight wrapper that simply refers to the raw bytes of the PDX that are kept in the cache. Using this method applications can choose to access PdxInstance instead of C++ object.
Note that a PdxInstance is only returned if a serialized PDX is found in the cache. If the cache contains a deserialized PDX, then a domain class instance is returned instead of a PdxInstance.
pdxReadSerialized | true to prefer PdxInstance |
CacheFactoryPtr apache::geode::client::CacheFactory::setPingInterval | ( | long | pingInterval | ) |
The frequency with which servers must be pinged to verify that they are still alive.
Each server will be sent a ping every pingInterval
if there has not been any other communication with the server.
These pings are used by the server to monitor the health of the client. Make sure that the pingInterval
is less than the maximum time between pings allowed by the bridge server.
pingInterval | is the amount of time in milliseconds between pings. |
this
IllegalArgumentException | if pingInterval is less than 0 . |
CacheFactoryPtr apache::geode::client::CacheFactory::setPRSingleHopEnabled | ( | bool | enabled | ) |
By default setPRSingleHopEnabled is true
The client is aware of location of partitions on servers hosting Regions.
Using this information, the client routes the client cache operations directly to the server which is hosting the required partition for the cache operation. If setPRSingleHopEnabled is false the client can do an extra hop on servers to go to the required partition for that cache operation. The setPRSingleHopEnabled avoids extra hops only for following cache operations:
name | is boolean whether PR Single Hop optimization is enabled or not. |
this
CacheFactoryPtr apache::geode::client::CacheFactory::setReadTimeout | ( | int | timeout | ) |
Sets the number of milliseconds to wait for a response from a server before timing out the operation and trying another server (if any are available).
timeout | is the number of milliseconds to wait for a response from a server |
this
IllegalArgumentException | if timeout is less than or equal to 0 . |
CacheFactoryPtr apache::geode::client::CacheFactory::setRetryAttempts | ( | int | retryAttempts | ) |
Set the number of times to retry a request after timeout/exception.
retryAttempts | is the number of times to retry a request after timeout/exception. -1 indicates that a request should be tried against every available server before failing |
this
IllegalArgumentException | if idleTimout is less than 0 . |
CacheFactoryPtr apache::geode::client::CacheFactory::setServerGroup | ( | const char * | group | ) |
Configures the group which contains all the servers that this pool connects to.
group | is the server group that this pool will connect to. If the value is null or "" then the pool connects to all servers. |
this
CacheFactoryPtr apache::geode::client::CacheFactory::setSocketBufferSize | ( | int | bufferSize | ) |
Sets the socket buffer size for each connection made in this pool.
Large messages can be received and sent faster when this buffer is larger. Larger buffers also optimize the rate at which servers can send events for client subscriptions.
bufferSize | is the size of the socket buffers used for reading and writing on each connection in this pool. |
this
IllegalArgumentException | if bufferSize is less than or equal to 0 . |
CacheFactoryPtr apache::geode::client::CacheFactory::setStatisticInterval | ( | int | statisticInterval | ) |
The frequency with which the client statistics must be sent to the server.
Doing this allows GFMon
to monitor clients.
A value of -1
disables the sending of client statistics to the server.
statisticInterval | is the amount of time in milliseconds between sends of client statistics to the server. |
this
IllegalArgumentException | if statisticInterval is less than -1 . |
CacheFactoryPtr apache::geode::client::CacheFactory::setSubscriptionAckInterval | ( | int | ackInterval | ) |
Sets the is the interval in milliseconds to wait before sending acknowledgements to the bridge server for events received from the server subscriptions.
ackInterval | is the number of milliseconds to wait before sending event acknowledgements. |
this
IllegalArgumentException | if ackInterval is less than or equal to 0 . |
CacheFactoryPtr apache::geode::client::CacheFactory::setSubscriptionEnabled | ( | bool | enabled | ) |
If set to true
then the created pool will have server-to-client subscriptions enabled.
If set to false
then all Subscription*
attributes are ignored at the time of creation.
this
CacheFactoryPtr apache::geode::client::CacheFactory::setSubscriptionMessageTrackingTimeout | ( | int | messageTrackingTimeout | ) |
Sets the messageTrackingTimeout attribute which is the time-to-live period, in milliseconds, for subscription events the client has received from the server.
It is used to minimize duplicate events. Entries that have not been modified for this amount of time are expired from the list.
messageTrackingTimeout | is the number of milliseconds to set the timeout to. |
this
IllegalArgumentException | if messageTrackingTimeout is less than or equal to 0 . |
CacheFactoryPtr apache::geode::client::CacheFactory::setSubscriptionRedundancy | ( | int | redundancy | ) |
Sets the redundancy level for this pools server-to-client subscriptions.
If 0
then no redundant copies are kept on the servers. Otherwise an effort is made to maintain the requested number of copies of the server-to-client subscriptions. At most, one copy per server is made up to the requested level.
redundancy | is the number of redundant servers for this client's subscriptions. |
this
IllegalArgumentException | if redundancyLevel is less than -1 . |
CacheFactoryPtr apache::geode::client::CacheFactory::setThreadLocalConnections | ( | bool | threadLocalConnections | ) |
Sets the thread local connections policy for this pool.
If true
then any time a thread goes to use a connection from this pool it will check a thread local cache and see if it already has a connection in it. If so it will use it. If not it will get one from this pool and cache it in the thread local. This gets rid of thread contention for the connections but increases the number of connections the servers see.
If false
then connections are returned to the pool as soon as the operation being done with the connection completes. This allows connections to be shared amonst multiple threads keeping the number of connections down.
threadLocalConnections | if true then enable thread local connections. |
this
CacheFactoryPtr apache::geode::client::CacheFactory::setUpdateLocatorListInterval | ( | long | updateLocatorListInterval | ) |
The frequency with which client updates the locator list.
To disable this set its value to 0.
updateLocatorListInterval | is the amount of time in milliseconds between checking locator list at locator. |