public interface ClientRegionFactory<K,V>
client cache
regions
. Instances of
this interface can be created using region shortcuts by calling
ClientCache.createClientRegionFactory(ClientRegionShortcut)
or using named region
attributes by calling ClientCache.createClientRegionFactory(String)
.
The factory can then be customized using its methods.
The final step is to produce a Region
by calling create(String)
.
Client regions may be:
ClientRegionShortcut
for the shortcuts for these three types of client regions.
Example: Create a client region with a CacheListener
ClientCache c = new ClientCacheFactory().addLocator(host, port).create(); // Create local caching region that is connected to a server side region // Add a cache listener before creating region Region r = c.createClientRegionFactory(CACHING_PROXY).addCacheListener(myListener).create("customers");
Modifier and Type | Method and Description |
---|---|
ClientRegionFactory<K,V> |
addCacheListener(CacheListener<K,V> aListener)
Adds a cache listener to the end of the list of cache listeners on this factory.
|
Region<K,V> |
create(String name)
Creates a region in the
ClientCache using the configuration contained in this
ClientRegionFactory. |
Region<K,V> |
createSubregion(Region<?,?> parent,
String name)
Creates a sub-region in the
ClientCache using the configuration contained in this
ClientRegionFactory. |
ClientRegionFactory<K,V> |
initCacheListeners(CacheListener<K,V>[] newListeners)
Removes all cache listeners and then adds each listener in the specified array.
|
ClientRegionFactory<K,V> |
setCloningEnabled(boolean cloningEnable)
Sets cloning on region Note: off-heap regions always behave as if cloning is enabled.
|
ClientRegionFactory<K,V> |
setCompressor(Compressor compressor)
Set the compressor to be used by this region for compressing region entry values.
|
void |
setConcurrencyChecksEnabled(boolean concurrencyChecksEnabled)
Enables or disabled concurrent modification checks
|
ClientRegionFactory<K,V> |
setConcurrencyLevel(int concurrencyLevel)
Sets the concurrency level tof the next
RegionAttributes created. |
ClientRegionFactory<K,V> |
setCustomEntryIdleTimeout(CustomExpiry<K,V> custom)
Sets the custom idleTimeout for the next
RegionAttributes created. |
ClientRegionFactory<K,V> |
setCustomEntryTimeToLive(CustomExpiry<K,V> custom)
Sets the custom timeToLive expiration method for the next
RegionAttributes
created. |
ClientRegionFactory<K,V> |
setDiskStoreName(String name)
Sets the DiskStore name attribute.
|
ClientRegionFactory<K,V> |
setDiskSynchronous(boolean isSynchronous)
Sets whether or not the writing to the disk is synchronous.
|
ClientRegionFactory<K,V> |
setEntryIdleTimeout(ExpirationAttributes idleTimeout)
Sets the idleTimeout expiration attributes for region entries for the next
RegionAttributes created. |
ClientRegionFactory<K,V> |
setEntryTimeToLive(ExpirationAttributes timeToLive)
Sets the timeToLive expiration attributes for region entries for the next
RegionAttributes created. |
ClientRegionFactory<K,V> |
setEvictionAttributes(EvictionAttributes evictionAttributes)
Sets the eviction attributes that controls growth of the Region to be created.
|
ClientRegionFactory<K,V> |
setInitialCapacity(int initialCapacity)
Sets the entry initial capacity for the next
RegionAttributes created. |
ClientRegionFactory<K,V> |
setKeyConstraint(Class<K> keyConstraint)
Sets the key constraint for the next
RegionAttributes created. |
ClientRegionFactory<K,V> |
setLoadFactor(float loadFactor)
Sets the entry load factor for the next
RegionAttributes created. |
ClientRegionFactory<K,V> |
setPoolName(String poolName)
Sets the pool name attribute.
|
ClientRegionFactory<K,V> |
setRegionIdleTimeout(ExpirationAttributes idleTimeout)
Sets the idleTimeout expiration attributes for the region itself for the next
RegionAttributes created. |
ClientRegionFactory<K,V> |
setRegionTimeToLive(ExpirationAttributes timeToLive)
Sets the timeToLive expiration attributes for the region itself for the next
RegionAttributes created. |
ClientRegionFactory<K,V> |
setStatisticsEnabled(boolean statisticsEnabled)
Sets whether statistics are enabled for this region and its entries.
|
ClientRegionFactory<K,V> |
setValueConstraint(Class<V> valueConstraint)
Sets the value constraint for the next
RegionAttributes created. |
ClientRegionFactory<K,V> addCacheListener(CacheListener<K,V> aListener)
aListener
- the cache listener to addIllegalArgumentException
- if aListener
is nullAttributesFactory.addCacheListener(org.apache.geode.cache.CacheListener<K, V>)
ClientRegionFactory<K,V> initCacheListeners(CacheListener<K,V>[] newListeners)
RegionAttributes
created.newListeners
- a possibly null or empty array of listeners to add to this factory.IllegalArgumentException
- if the newListeners
array has a null elementAttributesFactory.initCacheListeners(org.apache.geode.cache.CacheListener<K, V>[])
ClientRegionFactory<K,V> setEvictionAttributes(EvictionAttributes evictionAttributes)
evictionAttributes
- for the Region to createClientRegionFactory<K,V> setEntryIdleTimeout(ExpirationAttributes idleTimeout)
RegionAttributes
created.idleTimeout
- the idleTimeout ExpirationAttributes for entries in this regionIllegalArgumentException
- if idleTimeout is nullAttributesFactory.setEntryIdleTimeout(org.apache.geode.cache.ExpirationAttributes)
ClientRegionFactory<K,V> setCustomEntryIdleTimeout(CustomExpiry<K,V> custom)
RegionAttributes
created.custom
- the custom methodAttributesFactory.setCustomEntryIdleTimeout(CustomExpiry)
ClientRegionFactory<K,V> setEntryTimeToLive(ExpirationAttributes timeToLive)
RegionAttributes
created.timeToLive
- the timeToLive ExpirationAttributes for entries in this regionIllegalArgumentException
- if timeToLive is nullAttributesFactory.setEntryTimeToLive(org.apache.geode.cache.ExpirationAttributes)
ClientRegionFactory<K,V> setCustomEntryTimeToLive(CustomExpiry<K,V> custom)
RegionAttributes
created.custom
- the custom methodAttributesFactory.setCustomEntryTimeToLive(CustomExpiry)
ClientRegionFactory<K,V> setRegionIdleTimeout(ExpirationAttributes idleTimeout)
RegionAttributes
created.idleTimeout
- the ExpirationAttributes for this region idleTimeoutIllegalArgumentException
- if idleTimeout is nullAttributesFactory.setRegionIdleTimeout(org.apache.geode.cache.ExpirationAttributes)
ClientRegionFactory<K,V> setRegionTimeToLive(ExpirationAttributes timeToLive)
RegionAttributes
created.timeToLive
- the ExpirationAttributes for this region timeToLiveIllegalArgumentException
- if timeToLive is nullAttributesFactory.setRegionTimeToLive(org.apache.geode.cache.ExpirationAttributes)
ClientRegionFactory<K,V> setKeyConstraint(Class<K> keyConstraint)
RegionAttributes
created. Keys in the region
will be constrained to this class (or subclass). Any attempt to store a key of an incompatible
type in the region will cause a ClassCastException
to be thrown.keyConstraint
- The Class to constrain the keys to, or null if no constraintIllegalArgumentException
- if keyConstraint
is a class denoting a primitive
typeAttributesFactory.setKeyConstraint(java.lang.Class<K>)
ClientRegionFactory<K,V> setValueConstraint(Class<V> valueConstraint)
RegionAttributes
created. Values in the
region will be constrained to this class (or subclass). Any attempt to store a value of an
incompatible type in the region will cause a ClassCastException
to be thrown.valueConstraint
- The Class to constrain the values to, or null if no constraintIllegalArgumentException
- if valueConstraint
is a class denoting a
primitive typeAttributesFactory.setValueConstraint(java.lang.Class<V>)
ClientRegionFactory<K,V> setInitialCapacity(int initialCapacity)
RegionAttributes
created. This value
is used in initializing the map that holds the entries.initialCapacity
- the initial capacity of the entry mapIllegalArgumentException
- if initialCapacity is negative.HashMap
,
AttributesFactory.setInitialCapacity(int)
ClientRegionFactory<K,V> setLoadFactor(float loadFactor)
RegionAttributes
created. This value is
used in initializing the map that holds the entries.loadFactor
- the load factor of the entry mapIllegalArgumentException
- if loadFactor is nonpositiveHashMap
,
AttributesFactory.setLoadFactor(float)
ClientRegionFactory<K,V> setConcurrencyLevel(int concurrencyLevel)
RegionAttributes
created. This value is
used in initializing the map that holds the entries.concurrencyLevel
- the concurrency level of the entry mapIllegalArgumentException
- if concurrencyLevel is nonpositiveAttributesFactory.setConcurrencyLevel(int)
void setConcurrencyChecksEnabled(boolean concurrencyChecksEnabled)
concurrencyChecksEnabled
- whether to perform concurrency checks on operationsClientRegionFactory<K,V> setDiskStoreName(String name)
name
- the name of the diskstoreAttributesFactory.setDiskStoreName(java.lang.String)
ClientRegionFactory<K,V> setDiskSynchronous(boolean isSynchronous)
isSynchronous
- boolean if true indicates synchronous writesClientRegionFactory<K,V> setStatisticsEnabled(boolean statisticsEnabled)
statisticsEnabled
- whether statistics are enabledAttributesFactory.setStatisticsEnabled(boolean)
ClientRegionFactory<K,V> setCloningEnabled(boolean cloningEnable)
cloningEnable
- whether cloning is enabled on the regionAttributesFactory.setCloningEnabled(boolean)
ClientRegionFactory<K,V> setPoolName(String poolName)
The named connection pool must exist on the cache at the time these attributes are used to
create a region. See PoolManager.createFactory()
for how to create a connection pool.
poolName
- the name of the connection pool to useIllegalStateException
- if a cache loader or cache writer has already been set.PoolManager
ClientRegionFactory<K,V> setCompressor(Compressor compressor)
compressor
- a compressorRegion<K,V> create(String name) throws RegionExistsException
ClientCache
using the configuration contained in this
ClientRegionFactory. Validation of the provided attributes may cause exceptions to be thrown if
there are problems with the configuration data.name
- the name of the region to createRegionExistsException
- if a region with the given name already exists in this cacheCacheClosedException
- if the cache is closedRegion<K,V> createSubregion(Region<?,?> parent, String name) throws RegionExistsException
ClientCache
using the configuration contained in this
ClientRegionFactory. Validation of the provided attributes may cause exceptions to be thrown if
there are problems with the configuration data.parent
- the existing region that will contain the created sub-regionname
- the name of the region to createRegionExistsException
- if a region with the given name already exists in this cacheRegionDestroyedException
- if the parent region has been closed or destroyedCacheClosedException
- if the cache is closed