public interface ClientCache extends GemFireCache
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:
RegionService.getRegion(java.lang.String)
and RegionService.rootRegions()
).
createClientRegionFactory(ClientRegionShortcut)
and createClientRegionFactory(String)
).
getQueryService(java.lang.String)
and getLocalQueryService()
).GemFireCache.getLogger()
).GemFireCache.getDistributedSystem()
).GemFireCache.getResourceManager()
).GemFireCache.createDiskStoreFactory()
).createAuthenticatedView(java.util.Properties)
).
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 Region
s (created using ClientRegionFactory
) to talk to
regions on the server.
More pools can be created using PoolManager
or by declaring them in cache.xml.
Modifier and Type | Method and Description |
---|---|
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.
|
Pool |
getDefaultPool()
Returns the default server pool.
|
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.
|
createDiskStoreFactory, createGatewaySenderFactory, findDiskStore, getCacheTransactionManager, getCopyOnRead, getDistributedSystem, getInitializer, getInitializerProps, getJNDIContext, getLogger, getName, getPdxDiskStore, getPdxIgnoreUnreadFields, getPdxPersistent, getPdxReadSerialized, getPdxSerializer, getRegionAttributes, getResourceManager, getSecurityLogger, listRegionAttributes, loadCacheXml, setCopyOnRead, setRegionAttributes
close, createPdxEnum, createPdxInstanceFactory, getCancelCriterion, getQueryService, getRegion, isClosed, rootRegions
QueryService getQueryService(String poolName)
QueryService getLocalQueryService()
void close(boolean keepalive)
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.keepalive
- whether the server should keep the durable client's queues alive for the timeout periodCacheClosedException
- if the cache is already closed.<K,V> ClientRegionFactory<K,V> createClientRegionFactory(ClientRegionShortcut shortcut)
shortcut
- the predefined region attributes to initialize the factory with.<K,V> ClientRegionFactory<K,V> createClientRegionFactory(String regionAttributesId)
Named region attributes are defined in cache.xml by setting the name as
the value of the id
attribute on a region-attributes
element.
regionAttributesId
- the named region attributes to initialize the factory with.IllegalStateException
- if named region attributes has not been defined.void readyForEvents()
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.
IllegalStateException
- if called by a non-durable clientRegionService createAuthenticatedView(Properties userSecurityProperties)
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.
userSecurityProperties
- the security properties of a user.RegionService
instance associated with a user and the given
properties.UnsupportedOperationException
- when invoked with multiuser-authentication as false.RegionService createAuthenticatedView(Properties userSecurityProperties, String poolName)
multiuser-authentication
to be set to true
on the given pool.
See createAuthenticatedView(Properties)
for more information
on the returned cache view.
userSecurityProperties
- the security properties of a user.poolName
- - the pool that the users should be authenticated against.RegionService
instance associated with a user and the given
properties.Set<InetSocketAddress> getCurrentServers()
Copyright © 1997-2017 Pivotal Software, Inc. All rights reserved.