GemFire 6.6.4

com.gemstone.gemfire.cache.client
Interface ClientCache

All Superinterfaces:
GemFireCache, RegionService

public interface ClientCache
extends GemFireCache

A ClientCache instance controls the life cycle of the local singleton cache in a client.

A ClientCache is created using ClientCacheFactory.create(). See ClientCacheFactory for common usage patterns for creating the client cache instance.

ClientCache provides access to functionality when a member connects as a client to GemFire servers. It provides the following services:

A ClientCache connects to a server using a Pool. This pool can be configured in the ClientCacheFactory (by default GemFire tries to create a pool which tries to connect to a server on the localhost on port 40404). This default pool is used by Regions (created using ClientRegionFactory) to talk to regions on the server.

More pools can be created using PoolManager or by declaring them in cache.xml.

Since:
6.5

Method Summary
 void close(boolean keepalive)
          Terminates this object cache and releases all the resources.
 RegionService createAuthenticatedView(Properties userSecurityProperties)
          Creates an authenticated cache view using the given user security properties on the client cache's default pool.
 RegionService createAuthenticatedView(Properties userSecurityProperties, String poolName)
          Creates an authenticated cache view using the given user security properties using the given pool to connect to servers.
<K,V> ClientRegionFactory<K,V>
createClientRegionFactory(ClientRegionShortcut shortcut)
          Create and return a client region factory that is initialized to create a region using the given predefined region attributes.
<K,V> ClientRegionFactory<K,V>
createClientRegionFactory(String regionAttributesId)
          Create and return a client region factory that is initialized to create a region using the given named region attributes.
 Set<InetSocketAddress> getCurrentServers()
          Returns a set of the servers to which this client is currently connected.
 QueryService getLocalQueryService()
          Return a QueryService that queries the local state in the client cache.
 QueryService getQueryService(String poolName)
          Return the QueryService for the named pool.
 void readyForEvents()
          Notifies the server that this durable client is ready to receive updates.
 
Methods inherited from interface com.gemstone.gemfire.cache.GemFireCache
createDiskStoreFactory, findDiskStore, getCacheTransactionManager, getCopyOnRead, getDistributedSystem, getInitializer, getInitializerProps, getJNDIContext, getLogger, getName, getPdxDiskStore, getPdxIgnoreUnreadFields, getPdxPersistent, getPdxReadSerialized, getPdxSerializer, getRegionAttributes, getResourceManager, getSecurityLogger, listRegionAttributes, loadCacheXml, setCopyOnRead, setRegionAttributes
 
Methods inherited from interface com.gemstone.gemfire.cache.RegionService
close, createPdxEnum, createPdxInstanceFactory, getCancelCriterion, getQueryService, getRegion, isClosed, rootRegions
 

Method Detail

getQueryService

QueryService getQueryService(String poolName)
Return the QueryService for the named pool. The query operations performed using this QueryService will be executed on the servers that are associated with this pool.


getLocalQueryService

QueryService getLocalQueryService()
Return a QueryService that queries the local state in the client cache. These queries will not be sent to a server.


close

void close(boolean keepalive)
Terminates this object cache and releases all the resources. Calls Region.close() on each region in the cache. After this cache is closed, any further method call on this cache or any region object will throw CacheClosedException, unless otherwise noted.

Parameters:
keepalive - whether the server should keep the durable client's queues alive for the timeout period
Throws:
CacheClosedException - if the cache is already closed.

createClientRegionFactory

<K,V> ClientRegionFactory<K,V> createClientRegionFactory(ClientRegionShortcut shortcut)
Create and return a client region factory that is initialized to create a region using the given predefined region attributes.

Parameters:
shortcut - the predefined region attributes to initialize the factory with.
Returns:
a factory that will produce a client region.

createClientRegionFactory

<K,V> ClientRegionFactory<K,V> createClientRegionFactory(String regionAttributesId)
Create and return a client region factory that is initialized to create a region using the given named region attributes.

Named region attributes are defined in cache.xml by setting the name as the value of the id attribute on a region-attributes element.

Parameters:
regionAttributesId - the named region attributes to initialize the factory with.
Returns:
a factory that will produce a client region.
Throws:
IllegalStateException - if named region attributes has not been defined.

readyForEvents

void readyForEvents()
Notifies the server that this durable client is ready to receive updates. This method is used by durable clients to notify servers that they are ready to receive updates. As soon as the server receives this message, it will forward updates to this client (if necessary).

Durable clients must call this method after they are done creating regions and issuing interest registration requests.If it is called before then events will be lost.Any time a new Pool is created and regions have been added to it then this method needs to be called again.

For pools declared in cache.xml this method is implicitly called at the end of cache creation so the regions on that pool need to also be declared in cache.xml.

Throws:
IllegalStateException - if called by a non-durable client

createAuthenticatedView

RegionService createAuthenticatedView(Properties userSecurityProperties)
Creates an authenticated cache view using the given user security properties on the client cache's default pool. Multiple views with different user properties can be created on a single client cache. Requires that multiuser-authentication to be set to true on the default pool. Applications must use this instance to do operations, when multiuser-authentication is set to true.

Authenticated cache views are only allows to access proxy regions. The RegionService.getRegion(java.lang.String) method will throw IllegalStateException if an attempt is made to get a region that has local storage.

Parameters:
userSecurityProperties - the security properties of a user.
Returns:
the RegionService instance associated with a user and the given properties.
Throws:
UnsupportedOperationException - when invoked with multiuser-authentication as false.

createAuthenticatedView

RegionService createAuthenticatedView(Properties userSecurityProperties,
                                      String poolName)
Creates an authenticated cache view using the given user security properties using the given pool to connect to servers. Requires that multiuser-authentication to be set to true on the given pool.

See createAuthenticatedView(Properties) for more information on the returned cache view.

Parameters:
userSecurityProperties - the security properties of a user.
poolName - - the pool that the users should be authenticated against.
Returns:
the RegionService instance associated with a user and the given properties.

getCurrentServers

Set<InetSocketAddress> getCurrentServers()
Returns a set of the servers to which this client is currently connected.

Since:
6.6

GemFire 6.6.4

Copyright © 1997-2012 VMware, Inc. All rights reserved.