VMware GemFire Java API Reference
Interface Region<K,V>
-
- All Superinterfaces:
java.util.concurrent.ConcurrentMap<K,V>,java.util.Map<K,V>
public interface Region<K,V> extends java.util.concurrent.ConcurrentMap<K,V>Manages subregions and cached data. Each region can contain multiple subregions and entries for data. Regions provide a hierarchical name space within the cache. Also, a region can be used to group cached objects for management purposes.The Region interface basically contains two set of APIs: Region management APIs; and (potentially) distributed operations on entries. Non-distributed operations on entries are provided by the inner interface,
Region.Entry.Each
Cachedefines a single top region called the root region. User applications can use the root region to create subregions for isolated name space and object grouping.A region's name can be any String except that it should not contain the region name separator, a forward slash (/).
Regions can be referenced by a relative path name from any region higher in the hierarchy ingetSubregion(java.lang.String). You can get the relative path from the root region withgetFullPath(). The name separator is used to concatenate all the region names together from the root, starting with the root's subregions.Relative region names can provide a convenient method to locate a subregion directly from some higher region. For example, a region structure is as follows: a region named 3rd_level_region has parent region 2nd_level_region; region 2nd_level_region in turn has parent region 1st_level_region; and region 1st_level_region is a child of the root region. Then,the user can get the region 3rd_level_region from the root region by issuing:
or the user can get the region 3rd_level_region from region 1st_level_region by issuingregion3 = root.getSubregion("1st_level_region/2nd_level_region/3rd_level_region");region3 = region1.getSubregion("2nd_level_region/3rd_level_region");Region entries are identified by their key. Any Object can be used as a key as long as the key Object is region-wide unique and implements both the equals and hashCode methods. For regions with distributed scope, the key must also be Serializable.
Regions and their entries can be locked. The
Lockobtained fromgetRegionDistributedLock()is a distributed lock on the entire Region, and theLockobtained fromgetDistributedLock(java.lang.Object)is a distributed lock on the individual entry.If the scope is
Scope.GLOBAL, the methods that modify, destroy, or invalidate the entries in this region will also get a distributed lock. See the documentations forgetDistributedLock(java.lang.Object)andgetRegionDistributedLock()for details on the implicit locking that occurs for regions withScope.GLOBAL.Unless otherwise specified, all of these methods throw a
CacheClosedExceptionif the Cache is closed at the time of invocation, or aRegionDestroyedExceptionif this region has been destroyed. Serializability Requirements for arguments: Several methods in the region API take parameters such as key, value and callback parameters.All of these parameters are typed as objects. For distributed regions, keys, values and callback parameters have to be serializable Failure to meet these serialization requirements causes API methods to throw IllegalArgumentException.Implementation of the java.util.concurrent.ConcurrentMap interface was added in version 6.5. These methods give various levels of concurrency guarantees based on the scope and data policy of the region. They are implemented in the peer cache and client/server cache but are disallowed in peer Regions having NORMAL or EMPTY data policies.
The semantics of the ConcurrentMap methods on a Partitioned Region are consistent with those expected on a ConcurrentMap. In particular multiple writers in different JVMs of the same key in the same Partitioned Region will be done atomically.
The same is true for a region with GLOBAL scope. All operations will be done atomically since a distributed lock will be held while the operation is done.
The same is true for a region with LOCAL scope. All ops will be done atomically since the underlying map is a concurrent hash map and no distribution is involved.
For peer REPLICATE and PRELOADED regions atomicity is limited to threads in the JVM the operation starts in. There is no coordination with other members of the system unless the operation is performed in a transaction.
For client server regions the atomicity is determined by the scope and data policy of the server region as described above. The operation is actually performed on the server as described above. Clients will always send the ConcurrentMap operation to the server and the result returned by the ConcurrentMap method in client will reflect what was done on the server. Same goes for any CacheListener called on the client. Any local state on the client will be updated to be consistent with the state change made on the server.
- Since:
- GemFire 2.0
- See Also:
RegionAttributes,AttributesFactory,AttributesMutator,Region.Entry
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceRegion.Entry<K,V>A key-value pair containing the cached data in a region.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringSEPARATORThe region name separator character, represented as a string for convenience.static charSEPARATOR_CHARThe region name separator character.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description voidbecomeLockGrantor()Specifies this member to become the grantor for this region's lock service.voidclear()Removes all entries from this region.voidclose()Does a localDestroyRegion, but leaves behind the disk files if this is a region with persistBackup set to true.booleancontainsKey(java.lang.Object key)Returns whether the specified key currently exists in this region.booleancontainsKeyOnServer(java.lang.Object key)Returns whether the specified key currently exists in this region on the server.booleancontainsValue(java.lang.Object value)Returns true if this region maps one or more keys to the specified value.booleancontainsValueForKey(java.lang.Object key)Returns whether there is a valid (non-null) value present for the specified key.voidcreate(K key, V value)Creates a new entry in this region with the specified key and value if and only if an entry does not already exist for the specified key.voidcreate(K key, V value, java.lang.Object aCallbackArgument)Creates a new entry in this region with the specified key and value, providing a user-defined parameter object to anyCacheWriterinvoked in the process.<SK,SV>
Region<SK,SV>createSubregion(java.lang.String subregionName, RegionAttributes<SK,SV> aRegionAttributes)Deprecated.Vdestroy(java.lang.Object key)Destroys the entry with the specified key.Vdestroy(java.lang.Object key, java.lang.Object aCallbackArgument)Destroys the entry with the specified key, and provides a user-defined parameter object to anyCacheWriterinvoked in the process.voiddestroyRegion()Destroys the whole region.voiddestroyRegion(java.lang.Object aCallbackArgument)Destroys the whole region and provides a user-defined parameter object to anyCacheWriterinvoked in the process.java.util.Set<java.util.Map.Entry<K,V>>entrySet()Returns theSetofRegion.Entryobjects in this region.java.util.Set<Region.Entry<?,?>>entrySet(boolean recursive)Returns theSetofRegion.Entryobjects in this region.booleanequals(java.lang.Object other)Compares the specified object with this region for equality.booleanexistsValue(java.lang.String queryPredicate)Determines whether there is a value in thisRegionthat matches the givenqueryPredicate.voidforceRolling()Deprecated.useDiskStore.forceRoll()instead.Vget(java.lang.Object key)Returns the value associated with the specified key.Vget(java.lang.Object key, java.lang.Object aCallbackArgument)Returns the value associated with the specified key, passing the callback argument to any cache loaders or cache writers that are invoked in the operation.java.util.Map<K,V>getAll(java.util.Collection<?> keys)Gets values for all the keys in the input Collection.<T extends K>
java.util.Map<T,V>getAll(java.util.Collection<T> keys, java.lang.Object aCallbackArgument)Gets and returns values for all the keys in the input Collection.RegionAttributes<K,V>getAttributes()Returns theRegionAttributesfor this region.AttributesMutator<K,V>getAttributesMutator()Returns a mutator object used for modifying this region's attributes after region creation.CachegetCache()Deprecated.as of 6.5 usegetRegionService()instead.java.util.concurrent.locks.LockgetDistributedLock(java.lang.Object key)ForScope.GLOBALregions, gets a distributed lock on the entry with the specified key.Region.Entry<K,V>getEntry(java.lang.Object key)Returns theRegion.Entryfor the specified key, or null if it doesn't exist.java.lang.StringgetFullPath()Returns the full path of this region starting with a forward slash, followed by the root, including every subregion in the path to this region.java.util.List<K>getInterestList()Returns the list of keys on which this client is interested and will be notified of changes.java.util.List<java.lang.String>getInterestListRegex()Returns the list of regular expresssions on which this client is interested and will be notified of changes.java.lang.StringgetName()Returns the name of this region.<PK,PV>
Region<PK,PV>getParentRegion()Gets the parent region of this region.java.util.concurrent.locks.LockgetRegionDistributedLock()ForScope.GLOBALregions, gets a distributed lock on this whole region.RegionServicegetRegionService()Returns thecacheassociated with this region.RegionSnapshotService<K,V>getSnapshotService()Obtains the snapshot service to allow the cache data to be imported or exported.CacheStatisticsgetStatistics()Returns theCacheStatisticsfor this region.<SK,SV>
Region<SK,SV>getSubregion(java.lang.String path)Returns a subregion with the specified name or null if doesn't exist.java.lang.ObjectgetUserAttribute()Returns the application-defined object associated with this region.inthashCode()Returns the hash code value for this region.voidinvalidate(java.lang.Object key)Invalidates the entry with the specified key.voidinvalidate(java.lang.Object key, java.lang.Object aCallbackArgument)Invalidates the entry with the specified key, and provides a user-defined argument to theCacheListener.voidinvalidateRegion()Invalidates this region.voidinvalidateRegion(java.lang.Object aCallbackArgument)Invalidates this region.booleanisDestroyed()Returns whether this region has been destroyed.booleanisEmpty()Returns true if this region contains no entries.booleanisEmptyOnServer()Returns true if this region contains no entries on the server.java.util.Set<K>keySet()Returns a set of keys in the region.java.util.Set<K>keySetOnServer()Returns a set of keys in the region on the server.voidloadSnapshot(java.io.InputStream inputStream)Deprecated.as of 7.0 usegetSnapshotService()voidlocalClear()Removes all local entries from this region.voidlocalDestroy(java.lang.Object key)Destroys the value with the specified key in the local cache only, NoCacheWriteris invoked.voidlocalDestroy(java.lang.Object key, java.lang.Object aCallbackArgument)Destroys the value with the specified key in the local cache only, and provides a user-defined parameter object to theCacheListener, if any.voidlocalDestroyRegion()Destroys the whole region in the local cache only.voidlocalDestroyRegion(java.lang.Object aCallbackArgument)Destroys the whole region in the local cache only, and provides a user-defined argument to aCacheListenerif any.voidlocalInvalidate(java.lang.Object key)Invalidates the value with the specified key in the local cache only.voidlocalInvalidate(java.lang.Object key, java.lang.Object aCallbackArgument)Invalidates the value with the specified key in the local cache only, and provides a user-defined argument to theCacheListener.voidlocalInvalidateRegion()Invalidates this region in the local cache only.voidlocalInvalidateRegion(java.lang.Object aCallbackArgument)Invalidates this region in the local cache only, and provides a user-defined argument to theCacheListener.Vput(K key, V value)Places a new value into an entry in this region with the specified key.Vput(K key, V value, java.lang.Object aCallbackArgument)Places a new value into an entry in this region with the specified key, providing a user-defined parameter object to anyCacheWriterinvoked in the process.voidputAll(java.util.Map<? extends K,? extends V> map)Copies all of the entries from the specified map to this region.voidputAll(java.util.Map<? extends K,? extends V> map, java.lang.Object aCallbackArgument)Copies all of the entries from the specified map to this region.VputIfAbsent(K key, V value)If the specified key is not already associated with a value, associate it with the given value.<E> SelectResults<E>query(java.lang.String queryPredicate)Filters the values of this region using thequeryPredicate.voidregisterInterest(K key)Sends a request to the CacheServer to register interest in a key for this client.voidregisterInterest(K key, boolean isDurable)Sends a request to the CacheServer to register interest in a key for this client.voidregisterInterest(K key, boolean isDurable, boolean receiveValues)Sends a request to the CacheServer to register interest in a key for this client.voidregisterInterest(K key, InterestResultPolicy policy)Sends a request to the CacheServer to register interest in a key for this client.voidregisterInterest(K key, InterestResultPolicy policy, boolean isDurable)Sends a request to the CacheServer to register interest in a key for this client.voidregisterInterest(K key, InterestResultPolicy policy, boolean isDurable, boolean receiveValues)Sends a request to the CacheServer to register interest in a key for this client.default voidregisterInterestForAllKeys()Sends a request to the CacheServer to register interest in all keys for this client.default voidregisterInterestForAllKeys(InterestResultPolicy policy)Sends a request to the CacheServer to register interest in for all keys for this client.default voidregisterInterestForAllKeys(InterestResultPolicy policy, boolean isDurable)Sends a request to the CacheServer to register interest in all keys for this client.default voidregisterInterestForAllKeys(InterestResultPolicy policy, boolean isDurable, boolean receiveValues)Sends a request to the CacheServer to register interest in all keys for this client.default voidregisterInterestForKeys(java.lang.Iterable<K> iterable)Sends a request to the CacheServer to register interest for all key in the iterable for this client.default voidregisterInterestForKeys(java.lang.Iterable<K> iterable, InterestResultPolicy policy)Sends a request to the CacheServer to register interest for all key in the iterable for this client.default voidregisterInterestForKeys(java.lang.Iterable<K> iterable, InterestResultPolicy policy, boolean isDurable)Sends a request to the CacheServer to register interest for all key in the iterable for this client.default voidregisterInterestForKeys(java.lang.Iterable<K> iterable, InterestResultPolicy policy, boolean isDurable, boolean receiveValues)Sends a request to the CacheServer to register interest for all key in the iterable for this client.voidregisterInterestRegex(java.lang.String regex)Sends a request to the CacheServer to register interest in a regular expression pattern for this client.voidregisterInterestRegex(java.lang.String regex, boolean isDurable)Sends a request to the CacheServer to register interest in a regular expression pattern for this client.voidregisterInterestRegex(java.lang.String regex, boolean isDurable, boolean receiveValues)Sends a request to the CacheServer to register interest in a regular expression pattern for this client.voidregisterInterestRegex(java.lang.String regex, InterestResultPolicy policy)Sends a request to the CacheServer to register interest in a regular expression pattern for this client.voidregisterInterestRegex(java.lang.String regex, InterestResultPolicy policy, boolean isDurable)Sends a request to the CacheServer to register interest in a regular expression pattern for this client.voidregisterInterestRegex(java.lang.String regex, InterestResultPolicy policy, boolean isDurable, boolean receiveValues)Sends a request to the CacheServer to register interest in a regular expression pattern for this client.Vremove(java.lang.Object key)Removes the entry with the specified key.booleanremove(java.lang.Object key, java.lang.Object value)Removes the entry for a key only if currently mapped to a given value.voidremoveAll(java.util.Collection<? extends K> keys)Removes all of the entries for the specified keys from this region.voidremoveAll(java.util.Collection<? extends K> keys, java.lang.Object aCallbackArgument)Removes all of the entries for the specified keys from this region.Vreplace(K key, V value)Replaces the entry for a key only if currently mapped to some value.booleanreplace(K key, V oldValue, V newValue)Replaces the entry for a key only if currently mapped to a given value.voidsaveSnapshot(java.io.OutputStream outputStream)Deprecated.as of 7.0 usegetSnapshotService()java.lang.ObjectselectValue(java.lang.String queryPredicate)Selects the single value in thisRegionthat matches the given querypredicate.voidsetUserAttribute(java.lang.Object value)Sets the application-defined object associated with this region.intsize()Returns the number of entries present in this region.intsizeOnServer()Returns the number of entries present in this region on the server.java.util.Set<Region<?,?>>subregions(boolean recursive)Returns a Set of all subregions.voidunregisterInterest(K key)Sends a request to the CacheServer to unregister interest in a key for this client.voidunregisterInterestRegex(java.lang.String regex)Sends a request to the CacheServer to unregister interest in a regular expression pattern for this client.java.util.Collection<V>values()Returns a Collection of values in this region.voidwriteToDisk()Deprecated.useDiskStore.flush()instead.
-
-
-
Field Detail
-
SEPARATOR_CHAR
static final char SEPARATOR_CHAR
The region name separator character.- See Also:
- Constant Field Values
-
SEPARATOR
static final java.lang.String SEPARATOR
The region name separator character, represented as a string for convenience.- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
java.lang.String getName()
Returns the name of this region. A region's name can be any non-empty String providing it does not contain the name separator, a forward slash (/). If this is the root region, returns "root".Does not throw a
CacheClosedExceptionor aRegionDestroyedException.- Returns:
- the name of this region
-
getFullPath
java.lang.String getFullPath()
Returns the full path of this region starting with a forward slash, followed by the root, including every subregion in the path to this region. The path separator is a forward slash.Does not throw a
CacheClosedExceptionor aRegionDestroyedException.- Returns:
- the full path of this region
-
getParentRegion
<PK,PV> Region<PK,PV> getParentRegion()
Gets the parent region of this region. If this region is a root region (i.e. has no parents), returns null.Does not throw a
CacheClosedExceptionor aRegionDestroyedException.- Type Parameters:
PK- the type of keys in the parent regionPV- the type of values in the parent region- Returns:
- the parent region which contains this region; null, if this region is the root region
- See Also:
createSubregion
-
getAttributes
RegionAttributes<K,V> getAttributes()
Returns theRegionAttributesfor this region. This object is backed by this region, so if attributes are modified using this region'sAttributesMutator, thisRegionAttributesobject will immediately reflect the change.Does not throw a
CacheClosedExceptionor aRegionDestroyedException.- Returns:
- the
RegionAttributesof this region - See Also:
createSubregion(String, RegionAttributes),AttributesMutator,AttributesFactory,getAttributesMutator()
-
getAttributesMutator
AttributesMutator<K,V> getAttributesMutator()
Returns a mutator object used for modifying this region's attributes after region creation. Note that some attributes are immutable after region creation.- Returns:
- the
AttributesMutatorobject - See Also:
getAttributes()
-
getStatistics
CacheStatistics getStatistics() throws StatisticsDisabledException
Returns theCacheStatisticsfor this region. If the region is a partitioned proxy region then the values for all the statistics will be 0.- Returns:
- the
CacheStatisticsof this region - Throws:
StatisticsDisabledException- if statistics have been disabled for this region
-
invalidateRegion
void invalidateRegion() throws TimeoutExceptionInvalidates this region. Invalidation cascades to all entries and subregions. After theinvalidateRegion, this region and the entries in it still exist. To remove all the entries and this region,destroyRegionshould be used. The region invalidate will be distributed to other caches if the scope is notScope.LOCAL.Does not update any
CacheStatistics.- Throws:
LeaseExpiredException- if lease expired on distributed lock for Scope.GLOBALTimeoutException- if timed out getting distributed lock forScope.GLOBAL- See Also:
CacheListener.afterRegionInvalidate(org.apache.geode.cache.RegionEvent<K, V>)
-
invalidateRegion
void invalidateRegion(java.lang.Object aCallbackArgument) throws TimeoutExceptionInvalidates this region. The invalidation will cascade to all the subregions and cached entries. After theinvalidateRegion, the region and the entries in it still exist. In order to remove all the entries and the region,destroyRegionshould be used. The region invalidate will be distributed to other caches if the scope is notScope.LOCAL.Does not update any
CacheStatistics.- Parameters:
aCallbackArgument- a user-defined parameter to pass to callback events triggered by this method. Can be null. Should be serializable.- Throws:
LeaseExpiredException- if lease expired on distributed lock forScope.GLOBALTimeoutException- if timed out getting distributed lock forScope.GLOBALjava.lang.IllegalArgumentException- if aCallbackArgument is not serializable- See Also:
CacheListener.afterRegionInvalidate(org.apache.geode.cache.RegionEvent<K, V>)
-
localInvalidateRegion
void localInvalidateRegion()
Invalidates this region in the local cache only. Invalidation cascades to all entries and subregions. After theinvalidateRegion, this region and the entries in it still exist. To remove all the entries and this region, destroyRegion should be used. Does not update anyCacheStatistics.- Throws:
java.lang.IllegalStateException- if this region is distributed andreplicatedjava.lang.UnsupportedOperationException- If the region is a partitioned region- See Also:
CacheListener.afterRegionInvalidate(org.apache.geode.cache.RegionEvent<K, V>)
-
localInvalidateRegion
void localInvalidateRegion(java.lang.Object aCallbackArgument)
Invalidates this region in the local cache only, and provides a user-defined argument to theCacheListener. The invalidation will cascade to all the subregions and cached entries. After theinvalidateRegion, the region and the entries in it still exist. In order to remove all the entries and the region, destroyRegion should be used. Does not update anyCacheStatistics.- Parameters:
aCallbackArgument- a user-defined parameter to pass to callback events triggered by this method. Can be null.- Throws:
java.lang.IllegalStateException- if the region is distributed andreplicatedjava.lang.UnsupportedOperationException- If the region is a partitioned region- See Also:
CacheListener.afterRegionInvalidate(org.apache.geode.cache.RegionEvent<K, V>)
-
destroyRegion
void destroyRegion() throws CacheWriterException, TimeoutExceptionDestroys the whole region. Destroy cascades to all entries and subregions. After the destroy, this region object can not be used any more and any attempt to use this region object will getRegionDestroyedException. The region destroy will be distributed to other caches if the scope is notScope.LOCAL.Does not update any
CacheStatistics.- Throws:
CacheWriterException- if a CacheWriter aborts the operation; if this occurs some subregions may have already been successfully destroyed.LeaseExpiredException- if lease expired on distributed lock for Scope.GLOBALTimeoutException- if timed out getting distributed lock for Scope.GLOBAL- See Also:
CacheListener.afterRegionDestroy(org.apache.geode.cache.RegionEvent<K, V>),CacheWriter.beforeRegionDestroy(org.apache.geode.cache.RegionEvent<K, V>)
-
destroyRegion
void destroyRegion(java.lang.Object aCallbackArgument) throws CacheWriterException, TimeoutExceptionDestroys the whole region and provides a user-defined parameter object to anyCacheWriterinvoked in the process. Destroy cascades to all entries and subregions. After the destroy, this region object can not be used any more. Any attempt to use this region object will get aRegionDestroyedExceptionexception. The region destroy is distributed to other caches if the scope is notScope.LOCAL.Does not update any
CacheStatistics.- Parameters:
aCallbackArgument- a user-defined parameter to pass to callback events triggered by this method. Can be null. Should be serializable.- Throws:
CacheWriterException- if a CacheWriter aborts the operation; if this occurs some subregions may have already been successfully destroyed.LeaseExpiredException- if lease expired on distributed lock for Scope.GLOBALTimeoutException- if timed out getting distributed lock for Scope.GLOBALjava.lang.IllegalArgumentException- if aCallbackArgument is not serializable- See Also:
CacheListener.afterRegionDestroy(org.apache.geode.cache.RegionEvent<K, V>),CacheWriter.beforeRegionDestroy(org.apache.geode.cache.RegionEvent<K, V>)
-
localDestroyRegion
void localDestroyRegion()
Destroys the whole region in the local cache only. NoCacheWriteris invoked. Destroy cascades to all entries and subregions. After the destroy, this region object can not be used any more and any attempt to use this region object will getRegionDestroyedExceptionexception. This operation is not distributed to any other cache.Does not update any
CacheStatistics.
-
localDestroyRegion
void localDestroyRegion(java.lang.Object aCallbackArgument)
Destroys the whole region in the local cache only, and provides a user-defined argument to aCacheListenerif any. NoCacheWriteris invoked. Destroy will cascade to all the entries and subregions. After the destroy, this region object can not be used any more. Any attempt to use this region object will getRegionDestroyedExceptionexception.Does not update any
CacheStatistics.- Parameters:
aCallbackArgument- a user-defined parameter to pass to callback events triggered by this call. Can be null.- See Also:
CacheListener.afterRegionDestroy(org.apache.geode.cache.RegionEvent<K, V>)
-
close
void close()
Does a localDestroyRegion, but leaves behind the disk files if this is a region with persistBackup set to true. CallsCacheListener.afterRegionDestroy(org.apache.geode.cache.RegionEvent<K, V>)on each cache listener on the closed region(s). Also callsCacheCallback.close()on each callback on the closed region(s).Does not update any
CacheStatistics.
-
getSnapshotService
RegionSnapshotService<K,V> getSnapshotService()
Obtains the snapshot service to allow the cache data to be imported or exported.- Returns:
- the snapshot service for the region
-
saveSnapshot
@Deprecated void saveSnapshot(java.io.OutputStream outputStream) throws java.io.IOExceptionDeprecated.as of 7.0 usegetSnapshotService()Saves the data in this region in a snapshot file. The data is a "concurrent" snapshot in that modifications to the region while the snapshot is being written are not guaranteed to be included or excluded from the snapshot. In other words, if there are concurrent modifications to the region while the snapshot is being written, the snapshot may not reflect a consistent state of the entire region at any moment in time.- Parameters:
outputStream- the output stream to write to- Throws:
java.io.IOException- if encountered while writing the filejava.lang.UnsupportedOperationException- If the region is a partitioned region- See Also:
loadSnapshot(java.io.InputStream)
-
loadSnapshot
@Deprecated void loadSnapshot(java.io.InputStream inputStream) throws java.io.IOException, java.lang.ClassNotFoundException, CacheWriterException, TimeoutExceptionDeprecated.as of 7.0 usegetSnapshotService()Loads data from a file that was previously created with the saveSnapshot method. This method essentially destroys the region and automatically recreates it with the data in the snapshot. Any current data in the region is lost, replaced with the data in the snapshot file. Causes this region and all other regions with the same name in remote caches in this distributed system to be reinitialized: remote regions are cleared of all data and distributedreplicatedremote regions will do a new getInitialImage operation to get the data from this snapshot. Any existing references to this region or any region that is reinitialized in this manner become unusable in that any subsequent methods invoked on those references will throw a RegionReinitializedException (which is a subclass of RegionDestroyedException).In order to continue working with this region, a new reference needs to be acquired using Cache#getRegion or Region#getSubregion (which will block until reinitialization is complete).
NOTE: SUBREGIONS ARE DESTROYED. Since loading a snapshot effectively destroys the region and recreates it, all subregions of this region in this cache as well as other remote caches in the same distributed system are destroyed.
If any error occurs while loading the snapshot, this region is destroyed and threads in remote caches that are attempting to get a reference to this region will get null instead of a region reference. The only callbacks that are invoked are called for the destroyRegion operation, i.e. the CacheWriter and the close methods on callbacks. CacheListeners and other callback objects have their close() methods called when the region is destroyed, and then those same callback objects will be reinstalled on the new region. Therefore, the callback objects should be able to handle a close() followed by events associated with the newly created region.
- Parameters:
inputStream- the inputStream to load the snapshot from- Throws:
java.lang.ClassNotFoundException- if a class cannot be found while loading datajava.io.IOException- if error encountered while reading file.CacheWriterException- if a CacheWriter aborts the destroyRegion operation; if this occurs some subregions may have already been successfully destroyed.LeaseExpiredException- if lease expired on distributed lock for Scope.GLOBALTimeoutException- if timed out getting distributed lock for Scope.GLOBALjava.lang.UnsupportedOperationException- If the region is a partitioned region- See Also:
RegionReinitializedException
-
getSubregion
<SK,SV> Region<SK,SV> getSubregion(java.lang.String path)
Returns a subregion with the specified name or null if doesn't exist. The name is relative from this region, so it can be either a simple region name or a relative region path. IfregionNameis the empty string, then this region itself is returned.- Type Parameters:
SK- the type of keys in the subregionSV- the type of values in the subregion- Parameters:
path- the path to the subregion- Returns:
- a subregion with the specified relative path from this region, or null if it doesn't exist
- Throws:
java.lang.IllegalArgumentException- if path starts with a forward slash or- See Also:
Region,getFullPath()
-
createSubregion
@Deprecated <SK,SV> Region<SK,SV> createSubregion(java.lang.String subregionName, RegionAttributes<SK,SV> aRegionAttributes) throws RegionExistsException, TimeoutException
Deprecated.Creates a subregion with the specified name andRegionAttributes. The name must not contain a region name separator. If the subregion is a distributedreplicatedregion, it will be initialized with data from all other caches in this distributed system that have the same region.Updates the
CacheStatistics.getLastAccessedTime()andCacheStatistics.getLastModifiedTime()for this region.- Type Parameters:
SK- the type of keys in the subregionSV- the type of values in the subregion- Parameters:
subregionName- the subregion nameaRegionAttributes- the RegionAttributes to be used for the subregion- Returns:
- a subregion with the specified name
- Throws:
java.lang.IllegalArgumentException- if aRegionAttributes is null or if regionName is null, the empty string, or contains a '/'java.lang.IllegalStateException- If the supplied RegionAttributes violate the region creation constraints with a region of the same name in another cache in the distributed system or with this (parent) region.LeaseExpiredException- if lease expired on distributed lock for Scope.GLOBALTimeoutException- if timed out getting distributed lock for Scope.GLOBALRegionExistsException- if a subregion by the specified name already existsjava.lang.UnsupportedOperationException- If the region is a partitioned region- See Also:
AttributesFactory,getFullPath()
-
subregions
java.util.Set<Region<?,?>> subregions(boolean recursive)
Returns a Set of all subregions. If the recursive parameter is set to true, this call will recursively collect all subregions contained in this region. Otherwise, this call will only return the Set of direct subregions.This
Setis unmodifiable. It is backed by this region. Synchronization is not necessary to access or iterate over this set. NoConcurrentModificationExceptions will be thrown, but subregions may be added or removed while a thread is iterating. Iterators are intended to be used by one thread at a time. If a stable "snapshot" view of the set is required, then call one of the toArray methods on the set and iterate over the array.- Parameters:
recursive- if false, collects direct subregions only; if true, collects all subregions recursively- Returns:
- a Set of subregions
-
getEntry
Region.Entry<K,V> getEntry(java.lang.Object key)
Returns theRegion.Entryfor the specified key, or null if it doesn't exist.- Parameters:
key- the key corresponding to the Entry to return- Returns:
- the Region.Entry for the specified key or null if not found in this region
- Throws:
java.lang.NullPointerException- if key is null
-
get
V get(java.lang.Object key) throws CacheLoaderException, TimeoutException
Returns the value associated with the specified key. If the value is not present locally for this entry, a netSearch and/or a CacheLoader may be invoked to get the value, depending on the scope of this region. A netSearch looks for a value in every node of the system that defines this region. A netLoad invokes remote loaders one at a time until one returns a value or throws an exception. If any of these methods successfully retrieves a value than the value is immediately returned.For local scope, a local CacheLoader will be invoked if there is one. For global scope, the order is netSearch, localLoad, netLoad. For any other distributed scope, the order is localLoad, netSearch, netLoad.
netSearch and netLoad are never performed more than once, so if a loader attempts to do a netSearch and one was already done, then another one will not be done.
The value returned by get is not copied, so multi-threaded applications should not modify the value directly, but should use the update methods.
Updates the
CacheStatistics.getLastAccessedTime(),CacheStatistics.getHitCount(),CacheStatistics.getMissCount(), andCacheStatistics.getLastModifiedTime()(if a new value is loaded) for this region and the entry.If the
CacheWriterthrows aCacheWriterExceptionwhen a new value is retrieved from a loader, the value will not be put into the cache (a new entry will not be created) but the get will return the value and not propagate the exception.- Specified by:
getin interfacejava.util.Map<K,V>- Parameters:
key- whose associated value is to be returned. The key Object must implement the equals and hashCode methods. Note that even though key is typed as "Object" if a CacheLoader is used then make sure you only pass instances of "K" in this parameter.- Returns:
- the value with specified key, or null if the value is not found and can't be loaded
- Throws:
java.lang.NullPointerException- if the key is nulljava.lang.IllegalArgumentException- if the key does not meet the serializability requirementsLeaseExpiredException- if lease expired on distributed lock for Scope.GLOBALTimeoutException- if timed out doing asearchfor distributed or getting a distributed lock for Scope.GLOBALCacheLoaderException- if a cache loader throws an exception, or if the cache loader returns an object that is not serializable and this is a distributed regionPartitionedRegionStorageException- for a partitioned region fails to invoke aCacheLoader- See Also:
CacheLoader.load(org.apache.geode.cache.LoaderHelper<K, V>),CacheListener.afterCreate(org.apache.geode.cache.EntryEvent<K, V>),CacheListener.afterUpdate(org.apache.geode.cache.EntryEvent<K, V>),CacheWriter.beforeCreate(org.apache.geode.cache.EntryEvent<K, V>),CacheWriter.beforeUpdate(org.apache.geode.cache.EntryEvent<K, V>)
-
get
V get(java.lang.Object key, java.lang.Object aCallbackArgument) throws TimeoutException, CacheLoaderException
Returns the value associated with the specified key, passing the callback argument to any cache loaders or cache writers that are invoked in the operation. If the value is not present locally for this entry, a netSearch and/or a CacheLoader may be invoked to get the value, depending on the scope of this region. A netSearch looks for a value in every node of the system that defines this region. A netLoad invokes remote loaders one at a time until one returns a value or throws an exception. If any of these methods successfully retrieves a value than the value is immediately returned.For local scope, a local CacheLoader will be invoked if there is one. For global scope, the order is netSearch, localLoad, netLoad. For any other distributed scope, the order is localLoad, netSearch, netLoad.
netSearch and netLoad are never performed more than once, so if a loader attempts to do a netSearch and one was already done, then another one will not be done.
The value returned by get is not copied, so multi-threaded applications should not modify the value directly, but should use the update methods.
Updates the
CacheStatistics.getLastAccessedTime(),CacheStatistics.getHitCount(),CacheStatistics.getMissCount(), andCacheStatistics.getLastModifiedTime()(if a new value is loaded) for this region and the entry. If theCacheWriterthrows aCacheWriterExceptionwhen a new value is retrieved from a loader, then the value will not be put into the cache (a new entry will not be created) but the get will return the value and not propagate the exception.- Parameters:
key- whose associated value is to be returned. The key Object must implement the equals and hashCode methods. Note that even though key is typed as "Object" if a CacheLoader is used then make sure you only pass instances of "K" in this parameter.aCallbackArgument- an argument passed into the CacheLoader if loader is used. This same argument will also be subsequently passed to a CacheWriter if the loader returns a non-null value to be placed in the cache. Modifications to this argument made in the CacheLoader will be visible to the CacheWriter even if the loader and the writer are installed in different cache VMs. It will also be passed to any other callback events triggered by this method. May be null. Should be serializable.- Returns:
- the value with specified key, or null if the value is not found and can't be loaded
- Throws:
java.lang.NullPointerException- if key is nulljava.lang.IllegalArgumentException- if aCallbackArgument is not serializableLeaseExpiredException- if lease expired on distributed lock for Scope.GLOBALTimeoutException- if timed out doing asearchfor distributed or getting a distributed lock for Scope.GLOBALCacheLoaderException- if a cache loader throws an exception, or if the cache loader returns an object that is not serializable and this is a distributed regionPartitionedRegionStorageException- for a partitioned region fails to invoke aCacheLoader- See Also:
RegionAttributes,CacheLoader.load(org.apache.geode.cache.LoaderHelper<K, V>),CacheListener.afterCreate(org.apache.geode.cache.EntryEvent<K, V>),CacheListener.afterUpdate(org.apache.geode.cache.EntryEvent<K, V>),CacheWriter.beforeCreate(org.apache.geode.cache.EntryEvent<K, V>),CacheWriter.beforeUpdate(org.apache.geode.cache.EntryEvent<K, V>)
-
put
V put(K key, V value) throws TimeoutException, CacheWriterException
Places a new value into an entry in this region with the specified key. If there is already an entry associated with the specified key in this region, the entry's previous value is overwritten.Updates the
CacheStatistics.getLastAccessedTime()andCacheStatistics.getLastModifiedTime()for this region and the entry.- Specified by:
putin interfacejava.util.Map<K,V>- Parameters:
key- a key associated with the value to be put into this region. The key object must implement the equals and hashCode methods.value- the value to be put into the cache- Returns:
- the previous value stored locally for the key. If the entry did not exist then
nullis returned. If the entry was "invalid" thennullis returned. In some casesnullmay be returned even if a previous value exists. If the region is a client proxy thennullis returned. If the region is partitioned and the put is done on a non-primary thennullis returned. If the value is not currently stored in memory but is on disk and if the region does not have cqs thennullis returned. - Throws:
java.lang.NullPointerException- if key is null or if value is null (use invalidate instead), or if the key or value do not meet serializability requirementsjava.lang.ClassCastException- if key does not satisfy the keyConstraintLeaseExpiredException- if lease expired on distributed lock for Scope.GLOBALTimeoutException- if timed out getting distributed lock for Scope.GLOBALCacheWriterException- if a CacheWriter aborts the operationPartitionedRegionStorageException- if the operation could not be completed on a partitioned region.LowMemoryException- if a low memory condition is detected.- See Also:
invalidate(Object),CacheLoader.load(org.apache.geode.cache.LoaderHelper<K, V>),CacheListener.afterCreate(org.apache.geode.cache.EntryEvent<K, V>),CacheListener.afterUpdate(org.apache.geode.cache.EntryEvent<K, V>),CacheWriter.beforeCreate(org.apache.geode.cache.EntryEvent<K, V>),CacheWriter.beforeUpdate(org.apache.geode.cache.EntryEvent<K, V>)
-
put
V put(K key, V value, java.lang.Object aCallbackArgument) throws TimeoutException, CacheWriterException
Places a new value into an entry in this region with the specified key, providing a user-defined parameter object to anyCacheWriterinvoked in the process. If there is already an entry associated with the specified key in this region, the entry's previous value is overwritten.Updates the
CacheStatistics.getLastAccessedTime()andCacheStatistics.getLastModifiedTime()for this region and the entry.- Parameters:
key- a key associated with the value to be put into this region. The key object must implement the equals and hashCode methods.value- the value to be put into the cacheaCallbackArgument- a user-defined parameter to pass to callback events triggered by this method. Can be null. Should be serializable.- Returns:
- the previous value stored locally for the key. If the entry did not exist then
nullis returned. If the entry was "invalid" thennullis returned. In some casesnullmay be returned even if a previous value exists. If the region is a client proxy thennullis returned. If the region is off-heap and the old value was stored in off-heap memory thennullis returned. If the region is partitioned and the put is done on a non-primary thennullis returned. If the value is not currently stored in memory but is on disk and if the region does not have cqs thennullis returned. - Throws:
java.lang.NullPointerException- if key is nulljava.lang.IllegalArgumentException- if key, value, or aCallbackArgument do not meet serializability requirementsjava.lang.ClassCastException- if key does not satisfy the keyConstraintLeaseExpiredException- if lease expired on distributed lock for Scope.GLOBALTimeoutException- if timed out getting distributed lock for Scope.GLOBALCacheWriterException- if a CacheWriter aborts the operationPartitionedRegionStorageException- if the operation could not be completed on a partitioned region.LowMemoryException- if a low memory condition is detected.- See Also:
invalidate(Object),CacheLoader.load(org.apache.geode.cache.LoaderHelper<K, V>),CacheListener.afterCreate(org.apache.geode.cache.EntryEvent<K, V>),CacheListener.afterUpdate(org.apache.geode.cache.EntryEvent<K, V>),CacheWriter.beforeCreate(org.apache.geode.cache.EntryEvent<K, V>),CacheWriter.beforeUpdate(org.apache.geode.cache.EntryEvent<K, V>)
-
create
void create(K key, V value) throws TimeoutException, EntryExistsException, CacheWriterException
Creates a new entry in this region with the specified key and value if and only if an entry does not already exist for the specified key. If an entry already exists for the specified key, throwsEntryExistsException.Updates the
CacheStatistics.getLastAccessedTime()andCacheStatistics.getLastModifiedTime()for this region and the entry.If this region has a distributed scope, this operation may cause update events in caches that already have this region with this entry, and it will cause create events in other caches that have
all eventsconfigured.This operation gets a distributed lock on the entry if the scope is
Scope.GLOBAL.- Parameters:
key- the key for which to create the entry in this regionvalue- the value for the new entry, which may be null meaning the new entry starts as if it had been locally invalidated- Throws:
java.lang.NullPointerException- if key is nulljava.lang.IllegalArgumentException- if the key or value is not serializable and this is a distributed regionjava.lang.ClassCastException- if key does not satisfy the keyConstraintLeaseExpiredException- if lease expired on distributed lock for Scope.GLOBALTimeoutException- if timed out getting distributed lock forScope.GLOBALEntryExistsException- if an entry with this key already existsCacheWriterException- if a CacheWriter aborts the operationPartitionedRegionStorageException- if the operation could not be completed on a partitioned region.LowMemoryException- if a low memory condition is detected.- See Also:
CacheListener.afterCreate(org.apache.geode.cache.EntryEvent<K, V>),CacheListener.afterUpdate(org.apache.geode.cache.EntryEvent<K, V>),CacheWriter.beforeCreate(org.apache.geode.cache.EntryEvent<K, V>),CacheWriter.beforeUpdate(org.apache.geode.cache.EntryEvent<K, V>)
-
create
void create(K key, V value, java.lang.Object aCallbackArgument) throws TimeoutException, EntryExistsException, CacheWriterException
Creates a new entry in this region with the specified key and value, providing a user-defined parameter object to anyCacheWriterinvoked in the process. If this region has a distributed scope, then the value may be updated subsequently if other caches update the value.Updates the
CacheStatistics.getLastAccessedTime()andCacheStatistics.getLastModifiedTime()for this region and the entry.If this region has a distributed scope, this operation may cause update events in caches that already have this region with this entry, and it will cause create events in other caches that have
all eventsconfigured.- Parameters:
key- the key for which to create the entry in this regionvalue- the value for the new entry, which may be null meaning the new entry starts as if it had been locally invalidated.aCallbackArgument- a user-defined parameter to pass to callback events triggered by this method. Can be null. Should be serializable.- Throws:
java.lang.NullPointerException- if key is nulljava.lang.IllegalArgumentException- if the key, value, or aCallbackArgument do not meet serializability requirementsjava.lang.ClassCastException- if key does not satisfy the keyConstraintLeaseExpiredException- if lease expired on distributed lock for Scope.GLOBALTimeoutException- if timed out getting distributed lock forScope.GLOBALEntryExistsException- if an entry with this key already existsCacheWriterException- if a CacheWriter aborts the operationPartitionedRegionStorageException- if the operation could not be completed on a partitioned region.LowMemoryException- if a low memory condition is detected.- See Also:
CacheListener.afterCreate(org.apache.geode.cache.EntryEvent<K, V>),CacheListener.afterUpdate(org.apache.geode.cache.EntryEvent<K, V>),CacheWriter.beforeCreate(org.apache.geode.cache.EntryEvent<K, V>),CacheWriter.beforeUpdate(org.apache.geode.cache.EntryEvent<K, V>)
-
invalidate
void invalidate(java.lang.Object key) throws TimeoutException, EntryNotFoundExceptionInvalidates the entry with the specified key. Invalidate only removes the value from the entry, the key is kept intact. To completely remove the entry, destroy should be used. The invalidate will be distributed to other caches if the scope is not Scope.LOCAL.Does not update any
CacheStatistics.- Parameters:
key- the key of the value to be invalidated- Throws:
java.lang.NullPointerException- if key is nulljava.lang.IllegalArgumentException- if the key does not meet serializability requirementsLeaseExpiredException- if lease expired on distributed lock for Scope.GLOBALTimeoutException- if timed out getting distributed lock forScope.GLOBALEntryNotFoundException- if the entry does not exist in this region- See Also:
CacheListener.afterInvalidate(org.apache.geode.cache.EntryEvent<K, V>)
-
invalidate
void invalidate(java.lang.Object key, java.lang.Object aCallbackArgument) throws TimeoutException, EntryNotFoundExceptionInvalidates the entry with the specified key, and provides a user-defined argument to theCacheListener. Invalidate only removes the value from the entry, the key is kept intact. To completely remove the entry, destroy should be used.Does not update any
CacheStatistics.- Parameters:
key- the key of the value to be invalidatedaCallbackArgument- a user-defined parameter to pass to callback events triggered by this method. Can be null. Should be serializable.- Throws:
java.lang.NullPointerException- if key is nulljava.lang.IllegalArgumentException- if the key or the aCallbackArgument do not meet serializability requirementsLeaseExpiredException- if lease expired on distributed lock forScope.GLOBALTimeoutException- if timed out getting distributed lock forScope.GLOBALEntryNotFoundException- if this entry does not exist in this region- See Also:
CacheListener.afterInvalidate(org.apache.geode.cache.EntryEvent<K, V>)
-
localInvalidate
void localInvalidate(java.lang.Object key) throws EntryNotFoundExceptionInvalidates the value with the specified key in the local cache only. Invalidate will only remove the value from the entry, the key will be kept intact. In order to completely remove the key, entry and value, destroy should be called.Does not update any
CacheStatistics.- Parameters:
key- the key of the value to be invalidated- Throws:
java.lang.NullPointerException- if key is nulljava.lang.IllegalArgumentException- if the key does not meet serializability requirementsjava.lang.IllegalStateException- if this region is distributed andreplicatedEntryNotFoundException- if the entry does not exist in this region locallyjava.lang.UnsupportedOperationException- If the region is a partitioned regionUnsupportedOperationInTransactionException- If called in a transactional context- See Also:
CacheListener.afterInvalidate(org.apache.geode.cache.EntryEvent<K, V>)
-
localInvalidate
void localInvalidate(java.lang.Object key, java.lang.Object aCallbackArgument) throws EntryNotFoundExceptionInvalidates the value with the specified key in the local cache only, and provides a user-defined argument to theCacheListener. Invalidate will only remove the value from the entry, the key will be kept intact. In order to completely remove the key, entry and value, destroy should be called.Does not update any
CacheStatistics.- Parameters:
key- the key of the value to be invalidatedaCallbackArgument- a user-defined parameter to pass to callback events triggered by this method. Can be null.- Throws:
java.lang.NullPointerException- if key is nulljava.lang.IllegalStateException- if this region is distributed andreplicatedEntryNotFoundException- if this entry does not exist in this region locallyjava.lang.UnsupportedOperationException- If the region is a partitioned regionUnsupportedOperationInTransactionException- If called in a transactional context- See Also:
CacheListener.afterInvalidate(org.apache.geode.cache.EntryEvent<K, V>)
-
destroy
V destroy(java.lang.Object key) throws TimeoutException, EntryNotFoundException, CacheWriterException
Destroys the entry with the specified key. Destroy removes not only the value but also the key and entry from this region. Destroy will be distributed to other caches if the scope is notScope.LOCAL.Does not update any
CacheStatistics.- Parameters:
key- the key of the entry- Returns:
- the previous value stored locally for the key. If the entry was "invalid" then
nullis returned. In some casesnullmay be returned even if a previous value exists. If the region is a client proxy thennullis returned. If the region is off-heap and the old value was stored in off-heap memory thennullis returned. If the region is partitioned and the destroy is done on a non-primary thennullis returned. If the value is not currently stored in memory but is on disk and if the region does not have cqs thennullis returned. - Throws:
java.lang.NullPointerException- if key is nulljava.lang.IllegalArgumentException- if key does not meet serializability requirementsLeaseExpiredException- if lease expired on distributed lock for Scope.GLOBALTimeoutException- if timed out getting distributed lock for Scope.GLOBALEntryNotFoundException- if the entry does not exist in this regionCacheWriterException- if a CacheWriter aborts the operation- See Also:
CacheListener.afterDestroy(org.apache.geode.cache.EntryEvent<K, V>),CacheWriter.beforeDestroy(org.apache.geode.cache.EntryEvent<K, V>)
-
destroy
V destroy(java.lang.Object key, java.lang.Object aCallbackArgument) throws TimeoutException, EntryNotFoundException, CacheWriterException
Destroys the entry with the specified key, and provides a user-defined parameter object to anyCacheWriterinvoked in the process. Destroy removes not only the value but also the key and entry from this region. Destroy will be distributed to other caches if the scope is notScope.LOCAL.Does not update any
CacheStatistics.- Parameters:
key- the key of the entry to destroyaCallbackArgument- a user-defined parameter to pass to callback events triggered by this method. Can be null. Should be serializable.- Returns:
- the previous value stored locally for the key. If the entry was "invalid" then
nullis returned. In some casesnullmay be returned even if a previous value exists. If the region is a client proxy thennullis returned. If the region is off-heap and the old value was stored in off-heap memory thennullis returned. If the region is partitioned and the destroy is done on a non-primary thennullis returned. If the value is not currently stored in memory but is on disk and if the region does not have cqs thennullis returned. - Throws:
java.lang.NullPointerException- if key is nulljava.lang.IllegalArgumentException- if the key or aCallbackArgument do not meet serializability requirementsLeaseExpiredException- if lease expired on distributed lock for Scope.GLOBALTimeoutException- if timed out getting distributed lock for Scope.GLOBALEntryNotFoundException- if the entry does not exist in this regionCacheWriterException- if a CacheWriter aborts the operation- See Also:
CacheListener.afterDestroy(org.apache.geode.cache.EntryEvent<K, V>),CacheWriter.beforeDestroy(org.apache.geode.cache.EntryEvent<K, V>)
-
localDestroy
void localDestroy(java.lang.Object key) throws EntryNotFoundExceptionDestroys the value with the specified key in the local cache only, NoCacheWriteris invoked. Destroy removes not only the value but also the key and entry from this region.Does not update any
CacheStatistics.- Parameters:
key- the key of the entry to destroy- Throws:
java.lang.NullPointerException- if key is nulljava.lang.IllegalStateException- if this region is distributed andreplicatedEntryNotFoundException- if the entry does not exist in this region locallyjava.lang.UnsupportedOperationException- If the region is a partitioned regionUnsupportedOperationInTransactionException- If called in a transactional context- See Also:
CacheListener.afterDestroy(org.apache.geode.cache.EntryEvent<K, V>)
-
localDestroy
void localDestroy(java.lang.Object key, java.lang.Object aCallbackArgument) throws EntryNotFoundExceptionDestroys the value with the specified key in the local cache only, and provides a user-defined parameter object to theCacheListener, if any. NoCacheWriteris invoked. Destroy removes not only the value but also the key and entry from this region.Does not update any
CacheStatistics.- Parameters:
key- the key of the entry to destroyaCallbackArgument- a user-defined parameter to pass to callback events triggered by this method. Can be null.- Throws:
java.lang.NullPointerException- if key is nulljava.lang.IllegalStateException- if this region is distributed andreplicatedEntryNotFoundException- if the entry does not exist in this region locallyjava.lang.UnsupportedOperationException- If the region is a partitioned regionUnsupportedOperationInTransactionException- If called in a transactional context- See Also:
CacheListener.afterDestroy(org.apache.geode.cache.EntryEvent<K, V>)
-
keySet
java.util.Set<K> keySet()
Returns a set of keys in the region.This
Setis unmodifiable. It is backed by this region. Synchronization is not necessary to access or iterate over this set. NoConcurrentModificationExceptions will be thrown, but keys may be added or removed to this set while a thread is iterating. Iterators are intended to be used by one thread at a time. If a stable "snapshot" view of the set is required, then call one of the toArray methods on the set and iterate over the array. If you need to lock down the region so this set is not modified while it is being accessed, use global scope with a distributed lock.
-
values
java.util.Collection<V> values()
Returns a Collection of values in this region.This
Collectionis unmodifiable. It is backed by this region. Synchronization is not necessary to access or iterate over this collection. NoConcurrentModificationExceptions will be thrown, but values may be added or removed to this collection while a thread is iterating. Iterators are intended to be used by one thread at a time. If a stable "snapshot" view of the collection is required, then call one of the toArray methods on the collection and iterate over the array. If you need to lock down the region so this set is not modified while it is being accessed, use global scope with a distributed lock on the region.Null values are not included in the result collection.
-
entrySet
java.util.Set<Region.Entry<?,?>> entrySet(boolean recursive)
Returns theSetofRegion.Entryobjects in this region. If the recursive parameter is set to true, this call will recursively collect all the entries in this region and its subregions and return them in the Set; if false, it only returns entries directly contained in this region.This
Setis unmodifiable. It is backed by this region. Synchronization is not necessary to access or iterate over this set. NoConcurrentModificationExceptions will be thrown, but entries may be added or removed to this set while a thread is iterating. Iterators are intended to be used by one thread at a time. If a stable "snapshot" view of the set is required, then call one of the toArray methods on the set and iterate over the array. If you need to lock down the region so this set is not modified while it is being accessed, use global scope with a distributed lock.- Parameters:
recursive- if true, this call recursively collects all the entries in this region and its subregions; if false, it only returns the entries directly contained in this region- Returns:
- a Set of all the cached objects
- See Also:
Region.Entry
-
getCache
@Deprecated Cache getCache()
Deprecated.as of 6.5 usegetRegionService()instead.Returns theCacheassociated with this region.Does not throw a
CacheClosedExceptionif the Cache is closed.- Returns:
- the Cache
-
getRegionService
RegionService getRegionService()
Returns thecacheassociated with this region.Does not throw a
CacheClosedExceptionif the cache is closed.- Returns:
- the cache
- Since:
- GemFire 6.5
-
getUserAttribute
java.lang.Object getUserAttribute()
Returns the application-defined object associated with this region. GemFire does not use this object for any purpose.- Returns:
- the user attribute object or null if it has not been set
-
setUserAttribute
void setUserAttribute(java.lang.Object value)
Sets the application-defined object associated with this region. GemFire does not use this object for any purpose.- Parameters:
value- the application-defined object
-
isDestroyed
boolean isDestroyed()
Returns whether this region has been destroyed.Does not throw a
RegionDestroyedExceptionif this region has been destroyed.- Returns:
- true if this region has been destroyed
-
containsValueForKey
boolean containsValueForKey(java.lang.Object key)
Returns whether there is a valid (non-null) value present for the specified key. This method is equivalent to:Entry e = getEntry(key); return e != null && e.getValue() != null;
- Parameters:
key- the key to check for a valid value- Returns:
- true if there is an entry in this region for the specified key and it has a valid value
-
containsKey
boolean containsKey(java.lang.Object key)
Returns whether the specified key currently exists in this region. This method is equivalent togetEntry(key) != null.
-
getRegionDistributedLock
java.util.concurrent.locks.Lock getRegionDistributedLock() throws java.lang.IllegalStateExceptionForScope.GLOBALregions, gets a distributed lock on this whole region. This region lock cannot be acquired until all other caches release both region locks and any entry locks they hold in this region. Likewise, new entry locks cannot be acquired until outstanding region locks are released. The only place that a region distributed lock is acquired automatically is during region creation for distributedreplicatedregions when they acquire their initial data.The operations invalidateRegion and destroyRegion do not automatically acquire a distributed lock at all, so it is possible for these operations to cause an entry to be invalidated or the region to be destroyed even if a distributed lock is held on an entry. If an application requires all entry level locks to be released when a region is destroyed or invalidated as a whole, then it can call this method explicitly to get a ock on the entire region before calling invalidateRegion or destroyRegion.
See
getDistributedLock(java.lang.Object)for the list of operations that automatically acquire distributed entry locks for regions with global scope.Note that Region locks are potentially very expensive to acquire.
- Returns:
- a
Lockused for acquiring a distributed lock on the entire region - Throws:
java.lang.IllegalStateException- if the scope of this region is not globaljava.lang.UnsupportedOperationException- If the region is a partitioned region
-
getDistributedLock
java.util.concurrent.locks.Lock getDistributedLock(java.lang.Object key) throws java.lang.IllegalStateExceptionForScope.GLOBALregions, gets a distributed lock on the entry with the specified key. Use of thisLockenables an application to synchronize operations on entries at a higher level than provided for byScope.GLOBAL. This is the same lock that GemFire uses internally for operations that modify the cache with global scope, so this lock can be used for high-level synchronization with other caches that have this region with global scope. For example, if an application needs to get two values out of a region with global scope and guarantee that the first value is not modified before the second value is retrieved, it can use this lock in the following manner:Lock entry1Lock = myRegion.getDistributedLock(key1); Lock entry2Lock = myRegion.getDistributedLock(key2); entry1Lock.lock(); entry2Lock.lock(); try { Object val1 = myRegion.get(key1); Object val2 = myRegion.get(key2); // do something with val1 and val2 } finally { entry2Lock.unlock(); entry1Lock.unlock(); }You can also get a lock on an entry that does not exist in the local cache. Doing so guarantees that no other cache with the same region using global scope or using the same lock will create or update that entry while you have the lock. When a region has global scope, the following operations automatically acquire a distributed lock on an entry:create,put,destroy,invalidate, andgetthat causes a loader to be invoked.- Parameters:
key- the key on which to get a distributed lock- Returns:
- a
Lockused for acquiring a distributed lock on an entry - Throws:
java.lang.IllegalStateException- if the scope of this region is not globaljava.lang.NullPointerException- if key is nulljava.lang.UnsupportedOperationException- If the region is a partitioned region
-
writeToDisk
@Deprecated void writeToDisk()
Deprecated.useDiskStore.flush()instead.Initiates a flush to asynchronously write unwritten region entries to disk.- Throws:
java.lang.IllegalStateException- If this region is not configured to write to diskDiskAccessException- If problems are encounter while writing to diskjava.lang.UnsupportedOperationException- If the region is a partitioned region- Since:
- GemFire 3.2
- See Also:
AttributesFactory.setPersistBackup(boolean)
-
existsValue
boolean existsValue(java.lang.String queryPredicate) throws FunctionDomainException, TypeMismatchException, NameResolutionException, QueryInvocationTargetExceptionDetermines whether there is a value in thisRegionthat matches the givenqueryPredicate. Filters the values of this region using the predicate given as a string with the syntax of theWHEREclause of the query language. The predefined variablethismay be used inside the predicate to denote the current value being filtered.- Parameters:
queryPredicate- A query language boolean query predicate.- Returns:
trueif there is a value in region that matches the predicate, otherwisefalse.- Throws:
QueryInvalidException- If predicate does not correspond to valid query language syntax.FunctionDomainException- If more than one element evaluates to true.TypeMismatchException- If a bound parameter is not of the expected typeNameResolutionException- If a name in the query cannot be resolved.QueryInvocationTargetException- If the data referenced in from clause is not available for querying- Since:
- GemFire 4.0
- See Also:
QueryService
-
query
<E> SelectResults<E> query(java.lang.String queryPredicate) throws FunctionDomainException, TypeMismatchException, NameResolutionException, QueryInvocationTargetException
Filters the values of this region using thequeryPredicate. The queryPredicate should follow the syntax of query WHERE clause. When executed from a client, this method always runs on the server. However application should use QueryService to execute queries.- Type Parameters:
E- the type of elements in theSelectResults- Parameters:
queryPredicate- A query language boolean query predicate.- Returns:
- A
SelectResultscontaining the values of thisRegionthat match thepredicate. - Throws:
QueryInvalidException- If exception occurs during query compilation or processing.FunctionDomainException- If more than one element evaluates to true.TypeMismatchException- If a bound parameter is not of the expected typeNameResolutionException- If a name in the query cannot be resolved.QueryInvocationTargetException- If the data referenced in from clause is not available for querying- Since:
- GemFire 4.0
- See Also:
Pool.getQueryService(),RegionService.getQueryService(),QueryService
-
selectValue
java.lang.Object selectValue(java.lang.String queryPredicate) throws FunctionDomainException, TypeMismatchException, NameResolutionException, QueryInvocationTargetExceptionSelects the single value in thisRegionthat matches the given querypredicate. Filters the values of this region using the predicate given as a string with the syntax of the where clause of the query language. The predefined variablethismay be used inside the predicate to denote the element currently being filtered.- Parameters:
queryPredicate- A query language boolean query predicate.- Returns:
- The single element that evaluates to true for the predicate. If no value in this
Regionmatches the predicate,nullis returned. - Throws:
QueryInvalidException- If predicate does not correspond to valid query language syntax.FunctionDomainException- If more than one element evaluates to true.TypeMismatchException- If a bound parameter is not of the expected typeNameResolutionException- If a name in the query cannot be resolved.QueryInvocationTargetException- If the data referenced in from clause is not available for querying- Since:
- GemFire 4.0
- See Also:
QueryService
-
forceRolling
@Deprecated void forceRolling()
Deprecated.useDiskStore.forceRoll()instead.Asks the region to start writing to a new oplog (if persistence/overflow is turned on). The old one will be asynchronously compressed if compaction is set to true. If the region is not persistent/overflow no change in the region will be reflected. The new log will be created in the next available directory with free space. If there is no directory with free space available and compaction is set to false, then aDiskAccessExceptionsaying that the disk is full will be thrown. If compaction is true, the application will wait for the other oplogs to be compressed and more space to be created.- Since:
- GemFire 5.1
-
becomeLockGrantor
void becomeLockGrantor()
Specifies this member to become the grantor for this region's lock service. The grantor will be the lock authority which is responsible for handling all lock requests for this service. Other members will request locks from this member. Locking for this member will be optimal as it will not require messaging to acquire a given lock.Calls to this method will block until grantor authority has been transferred to this member.
If another member later calls
becomeLockGrantor, that member will transfer grantor authority from this member to itself. Multiple calls to this operation will have no effect unless another member has transferred grantor authority, in which case, this member will transfer grantor authority back to itself.This region's scope must be
Scope.GLOBALto become a lock grantor.This operation should not be invoked repeatedly in an application. It is possible to create a lock service and have two or more members endlessly calling becomeLockGrantor to transfer grantorship back and forth.
- Throws:
java.lang.IllegalStateException- if scope is not GLOBALjava.lang.UnsupportedOperationException- If the region is a partitioned region- Since:
- GemFire 4.0
-
localClear
void localClear()
Removes all local entries from this region. This is not a distributed operation. This operation is not allowed on replicated regions.- Throws:
java.lang.UnsupportedOperationException- If the region is a replicated regionjava.lang.UnsupportedOperationException- If the region is a partitioned region- Since:
- GemFire 5.0
- See Also:
CacheListener.afterRegionClear(org.apache.geode.cache.RegionEvent<K, V>)
-
clear
void clear()
Removes all entries from this region. Clear will be distributed to other caches if the scope is notScope.LOCAL.- Specified by:
clearin interfacejava.util.Map<K,V>- Throws:
java.lang.UnsupportedOperationException- If the region is a partitioned region- Since:
- GemFire 5.0
- See Also:
Map.clear(),CacheListener.afterRegionClear(org.apache.geode.cache.RegionEvent<K, V>),CacheWriter.beforeRegionClear(org.apache.geode.cache.RegionEvent<K, V>)
-
containsValue
boolean containsValue(java.lang.Object value)
Returns true if this region maps one or more keys to the specified value. More formally, returns true if and only if this region contains at least one entry to a value v such that (value==null ? v==null : value.equals(v)). This operation is not distributed and only the current region will be checked for this value.
-
entrySet
java.util.Set<java.util.Map.Entry<K,V>> entrySet()
Returns theSetofRegion.Entryobjects in this region.This
Setis unmodifiable. It is backed by this region. Synchronization is not necessary to access or iterate over this set. NoConcurrentModificationExceptions will be thrown, but entries may be added or removed to this set while a thread is iterating. Iterators are intended to be used by one thread at a time. If a stable "snapshot" view of the set is required, then call one of the toArray methods on the set and iterate over the array. If you need to lock down the region so this set is not modified while it is being accessed, use global scope with a distributed lock. A remove called on an entry via the iterator will result in an UnsupportedOperationException The Region.Entry obtained via the iterator is backed by the region. If a setValue on that entry is called, it will be similar in effect as calling a put on that key.
-
isEmpty
boolean isEmpty()
Returns true if this region contains no entries.
-
putAll
void putAll(java.util.Map<? extends K,? extends V> map)
Copies all of the entries from the specified map to this region. The effect of this call is equivalent to that of callingput(Object, Object)on this region once for each entry in the specified map. This operation will be distributed to other caches if the scope is notScope.LOCAL. If an exception is thrown due to this call, it can imply that there may have been a partial update performed on the region.- Specified by:
putAllin interfacejava.util.Map<K,V>- Parameters:
map- the key/value pairs to put in this region- Throws:
ServerOperationException- if called from a client, and the server throws an exception such as CacheWriterException, PartitionedRegionStorageException or LowMemoryException. These server exceptions become the ServerOperationException causeServerConnectivityException- if called from a client, and the server throws CancelException. CancelException will be the ServerConnectivityException causejava.lang.NullPointerException- if the key is null, if the value is null (use invalidate instead), or if the key or value do not meet serialization requirementsjava.lang.ClassCastException- if key does not satisfy the keyConstraintLeaseExpiredException- if the lease expired on a distributed lock, for regions with Scope.GLOBALTimeoutException- if the call timed out waiting to acquire a distributed lock for regions with Scope.GLOBALCacheWriterException- if a CacheWriter aborts the operationPartitionedRegionStorageException- if the operation could not be completed on a partitioned regionLowMemoryException- if a low memory condition is detected- Since:
- GemFire 5.0
- See Also:
invalidate(Object),CacheLoader.load(org.apache.geode.cache.LoaderHelper<K, V>),CacheListener.afterCreate(org.apache.geode.cache.EntryEvent<K, V>),CacheListener.afterUpdate(org.apache.geode.cache.EntryEvent<K, V>),CacheWriter.beforeCreate(org.apache.geode.cache.EntryEvent<K, V>),CacheWriter.beforeUpdate(org.apache.geode.cache.EntryEvent<K, V>),Map.putAll(Map map)
-
putAll
void putAll(java.util.Map<? extends K,? extends V> map, java.lang.Object aCallbackArgument)
Copies all of the entries from the specified map to this region. The effect of this call is equivalent to that of callingput(Object, Object)on this region once for each entry in the specified map. This operation will be distributed to other caches if the scope is notScope.LOCAL. If an exception is thrown due to this call, it can imply that there may have been a partial update performed on the region.- Parameters:
map- the key/value pairs to put in this regionaCallbackArgument- a user-defined parameter to pass to callback events triggered by this method. May be null. Must be serializable if this operation is distributed- Throws:
ServerOperationException- if called from a client, and the server throws an exception such as CacheWriterException, PartitionedRegionStorageException or LowMemoryException. These server exceptions become the ServerOperationException causeServerConnectivityException- if called from a client, and the server throws CancelException. CancelException will be the ServerConnectivityException causejava.lang.NullPointerException- if the key is null, if the value is null (use invalidate instead), or if the key or value do not meet serialization requirementsjava.lang.ClassCastException- if key does not satisfy the keyConstraintLeaseExpiredException- if the lease expired on a distributed lock, for regions with Scope.GLOBALTimeoutException- if the call timed out waiting to acquire a distributed lock for regions with Scope.GLOBALCacheWriterException- if a CacheWriter aborts the operationPartitionedRegionStorageException- if the operation could not be completed on a partitioned regionLowMemoryException- if a low memory condition is detected- Since:
- GemFire 8.1
- See Also:
invalidate(Object),CacheLoader.load(org.apache.geode.cache.LoaderHelper<K, V>),CacheListener.afterCreate(org.apache.geode.cache.EntryEvent<K, V>),CacheListener.afterUpdate(org.apache.geode.cache.EntryEvent<K, V>),CacheWriter.beforeCreate(org.apache.geode.cache.EntryEvent<K, V>),CacheWriter.beforeUpdate(org.apache.geode.cache.EntryEvent<K, V>),Map.putAll(Map map)
-
removeAll
void removeAll(java.util.Collection<? extends K> keys)
Removes all of the entries for the specified keys from this region. The effect of this call is equivalent to that of callingdestroy(Object)on this region once for each key in the specified collection. If an entry does not exist that key is skipped; EntryNotFoundException is not thrown. This operation will be distributed to other caches if the scope is notScope.LOCAL.- Parameters:
keys- the keys to remove from this region.- Since:
- GemFire 8.1
- See Also:
destroy(Object)
-
removeAll
void removeAll(java.util.Collection<? extends K> keys, java.lang.Object aCallbackArgument)
Removes all of the entries for the specified keys from this region. The effect of this call is equivalent to that of callingdestroy(Object, Object)on this region once for each key in the specified collection. If an entry does not exist that key is skipped; EntryNotFoundException is not thrown. This operation will be distributed to other caches if the scope is notScope.LOCAL.- Parameters:
keys- the keys to remove from this region.aCallbackArgument- a user-defined parameter to pass to callback events triggered by this method. May be null. Must be serializable if this operation is distributed.- Since:
- GemFire 8.1
- See Also:
destroy(Object, Object)
-
getAll
java.util.Map<K,V> getAll(java.util.Collection<?> keys)
Gets values for all the keys in the input Collection. If a given key does not exist in the region then that key's value in the returned map will benull.Note that the keys collection should extend K since a load may be done and the key in that case will be stored in the region. The keys parameter was not changed to extend K for backwards compatibility.
- Parameters:
keys- A Collection of keys- Returns:
- A Map of values for the input keys
- Since:
- GemFire 5.7
-
getAll
<T extends K> java.util.Map<T,V> getAll(java.util.Collection<T> keys, java.lang.Object aCallbackArgument)
Gets and returns values for all the keys in the input Collection. If a given key does not exist in the region then that key's value in the returned map will benull.- Type Parameters:
T- the type of the keys passed to getAll- Parameters:
keys- A Collection of keysaCallbackArgument- an argument passed into the CacheLoader if a loader is used. This same argument will also be subsequently passed to a CacheWriter if the loader returns a non-null value to be placed in the cache. Modifications to this argument made in the CacheLoader will be visible to the CacheWriter even if the loader and the writer are installed in different cache VMs. It will also be passed to any other callback events triggered by this method. May be null. Must be serializable if this operation is distributed.- Returns:
- A Map of values for the input keys
- Since:
- GemFire 8.1
-
remove
V remove(java.lang.Object key)
Removes the entry with the specified key. The operation removes not only the value but also the key and entry from this region. Remove will be distributed to other caches if the scope is notScope.LOCAL.Does not update any
CacheStatistics.- Specified by:
removein interfacejava.util.Map<K,V>- Parameters:
key- the key of the entry- Returns:
nullis returned if an entry for key does not exist otherwise the value that was stored locally for the removed entry is returned. If the entry was "invalid" thennullis returned. In some casesnullmay be returned even if a previous value exists. If the region is a client proxy thennullis returned. If the region is off-heap and the old value was stored in off-heap memory thennullis returned. If the region is partitioned and the remove is done on a non-primary thennullis returned. If the value is not currently stored in memory but is on disk and if the region does not have cqs thennullis returned.- Throws:
java.lang.NullPointerException- if key is nulljava.lang.IllegalArgumentException- if key does not meet serializability requirementsLeaseExpiredException- if lease expired on distributed lock for Scope.GLOBALTimeoutException- if timed out getting distributed lock for Scope.GLOBALCacheWriterException- if a CacheWriter aborts the operation- Since:
- GemFire 5.0
- See Also:
destroy(Object),CacheListener.afterDestroy(org.apache.geode.cache.EntryEvent<K, V>),CacheWriter.beforeDestroy(org.apache.geode.cache.EntryEvent<K, V>),Map.remove(Object)
-
size
int size()
Returns the number of entries present in this region. ForDataPolicy.PARTITION, this is a distributed operation that returns the number of entries present in entire region. For all other types of regions, it returns the number of entries present locally, and it is not a distributed operation.
-
equals
boolean equals(java.lang.Object other)
Compares the specified object with this region for equality. Regions are only equal to themselves (identity based) soObject.equals(java.lang.Object)is used. Note that some other class that implementsMapmay say that it is equal to an instance of Region (since Region implements Map) even though Region will never say that it is equal to that instance.
-
hashCode
int hashCode()
Returns the hash code value for this region. The hash code of a region is based on identity and usesObject.hashCode().
-
registerInterest
void registerInterest(K key)
Sends a request to the CacheServer to register interest in a key for this client. Updates to this key by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. This key is first locally cleared from the client and current value for this key is inserted into the local cache before this call returns.- Parameters:
key- The key on which to register interest.###Deprecated behavior###
The following
Listand 'ALL_KEYS' behavior is now deprecated. As an alternative, please useregisterInterestForKeys(Iterable, InterestResultPolicy)registerInterestForAllKeys(InterestResultPolicy)If the key is a
List, then all the keys in theListwill be registered. The key can also be the special token 'ALL_KEYS', which will register interest in all keys in the region. In effect, this will cause an update to any key in this region in the CacheServer to be pushed to the client.Using 'ALL_KEYS' is the same as calling
registerInterestRegex(String)with ".*" as the argument. This means that all keys of any type are pushed to the client and inserted into the local cache.###End of deprecation###
This method uses the default
InterestResultPolicy.If you locally-destroy a key and your region has concurrency-checks-enabled turned off you will not receive invalidation events from your interest subscription for that key. When concurrency-checks-enabled is turned on GemFire will accept invalidation and deliver these events to your client cache.
- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subscriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- GemFire 4.2
- See Also:
InterestResultPolicy
-
registerInterest
void registerInterest(K key, InterestResultPolicy policy)
Sends a request to the CacheServer to register interest in a key for this client. Updates to this key by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. This key is first locally cleared from the client and current value for this key is inserted into the local cache before this call returns. (if requested).If you locally-destroy a key and your region has concurrency-checks-enabled turned off you will not receive invalidation events from your interest subscription for that key. When concurrency-checks-enabled is turned on GemFire will accept invalidation and deliver these events to your client cache.
- Parameters:
key- The key on which to register interest.###Deprecated behavior###
The following
Listand 'ALL_KEYS' behavior is now deprecated. As an alternative, please useregisterInterestForKeys(Iterable, InterestResultPolicy)registerInterestForAllKeys(InterestResultPolicy)If the key is a
List, then all the keys in theListwill be registered. The key can also be the special token 'ALL_KEYS', which will register interest in all keys in the region. In effect, this will cause an update to any key in this region in the CacheServer to be pushed to the client.Using 'ALL_KEYS' is the same as calling
registerInterestRegex(String)with ".*" as the argument. This means that all keys of any type are pushed to the client and inserted into the local cache.###End of deprecation###
policy- The interest result policy. This can be one of:- InterestResultPolicy.NONE - does not initialize the local cache
- InterestResultPolicy.KEYS - initializes the local cache with the keys satisfying the request
- InterestResultPolicy.KEYS_VALUES - initializes the local cache with the keys and current values satisfying the request
- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subcriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- GemFire 4.2.3
- See Also:
InterestResultPolicy
-
registerInterestForAllKeys
default void registerInterestForAllKeys()
Sends a request to the CacheServer to register interest in all keys for this client. Updates to any key by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. The keys are first locally cleared from the client and current value for the keys are inserted into the local cache before this call returns.- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subscriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- Geode 1.5
-
registerInterestForAllKeys
default void registerInterestForAllKeys(InterestResultPolicy policy)
Sends a request to the CacheServer to register interest in for all keys for this client. Updates to any key by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. The keys are first locally cleared from the client and current value for the keys are inserted into the local cache before this call returns. (if requested).If you locally-destroy a key and your region has concurrency-checks-enabled turned off you will not receive invalidation events from your interest subscription for that key. When concurrency-checks-enabled is turned on GemFire will accept invalidation and deliver these events to your client cache.
- Parameters:
policy- The interest result policy. This can be one of:- InterestResultPolicy.NONE - does not initialize the local cache
- InterestResultPolicy.KEYS - initializes the local cache with the keys satisfying the request
- InterestResultPolicy.KEYS_VALUES - initializes the local cache with the keys and current values satisfying the request
- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subcriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- Geode 1.5
- See Also:
InterestResultPolicy
-
registerInterestForAllKeys
default void registerInterestForAllKeys(InterestResultPolicy policy, boolean isDurable)
Sends a request to the CacheServer to register interest in all keys for this client. Updates to any key by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. The keys are first locally cleared from the client and the current value for the keys are inserted into the local cache before this call returns (if requested).- Parameters:
policy- The interest result policy. This can be one of:- InterestResultPolicy.NONE - does not initialize the local cache
- InterestResultPolicy.KEYS - initializes the local cache with the keys satisfying the request
- InterestResultPolicy.KEYS_VALUES - initializes the local cache with the keys and current values satisfying the request
isDurable- true if the register interest is durable- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subscriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- Geode 1.5
- See Also:
InterestResultPolicy
-
registerInterestForAllKeys
default void registerInterestForAllKeys(InterestResultPolicy policy, boolean isDurable, boolean receiveValues)
Sends a request to the CacheServer to register interest in all keys for this client. Updates to any key by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. The keys are first locally cleared from the client and the current value for the keys are inserted into the local cache before this call returns (if requested).If you locally-destroy a key and your region has concurrency-checks-enabled turned off you will not receive invalidation events from your interest subscription for that key. When concurrency-checks-enabled is turned on GemFire will accept invalidation and deliver these events to your client cache.
- Parameters:
policy- The interest result policy. This can be one of:- InterestResultPolicy.NONE - does not initialize the local cache
- InterestResultPolicy.KEYS - initializes the local cache with the keys satisfying the request
- InterestResultPolicy.KEYS_VALUES - initializes the local cache with the keys and current values satisfying the request
isDurable- true if the register interest is durablereceiveValues- defaults to true. set to false to receive create or update events as invalidates similar to notify-by-subscription false.- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subscriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- Geode 1.5
- See Also:
InterestResultPolicy
-
registerInterestForKeys
default void registerInterestForKeys(java.lang.Iterable<K> iterable)
Sends a request to the CacheServer to register interest for all key in the iterable for this client. Updates to any of the keys in the iterable by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. The keys are first locally cleared from the client and current value for the keys are inserted into the local cache before this call returns. (if requested).If you locally-destroy a key and your region has concurrency-checks-enabled turned off you will not receive invalidation events from your interest subscription for that key. When concurrency-checks-enabled is turned on GemFire will accept invalidation and deliver these events to your client cache.
- Parameters:
iterable- TheIterableof keys on which to register interest.- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subcriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- Geode 1.5
-
registerInterestForKeys
default void registerInterestForKeys(java.lang.Iterable<K> iterable, InterestResultPolicy policy)
Sends a request to the CacheServer to register interest for all key in the iterable for this client. Updates to any of the keys in the iterable by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. The keys are first locally cleared from the client and current value for the keys are inserted into the local cache before this call returns. (if requested).If you locally-destroy a key and your region has concurrency-checks-enabled turned off you will not receive invalidation events from your interest subscription for that key. When concurrency-checks-enabled is turned on GemFire will accept invalidation and deliver these events to your client cache.
- Parameters:
iterable- TheIterableof keys on which to register interest.policy- The interest result policy. This can be one of:- InterestResultPolicy.NONE - does not initialize the local cache
- InterestResultPolicy.KEYS - initializes the local cache with the keys satisfying the request
- InterestResultPolicy.KEYS_VALUES - initializes the local cache with the keys and current values satisfying the request
- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subcriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- Geode 1.5
- See Also:
InterestResultPolicy
-
registerInterestForKeys
default void registerInterestForKeys(java.lang.Iterable<K> iterable, InterestResultPolicy policy, boolean isDurable)
Sends a request to the CacheServer to register interest for all key in the iterable for this client. Updates to any of the keys in the iterable by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. The keys are first locally cleared from the client and current value for the keys are inserted into the local cache before this call returns. (if requested).If you locally-destroy a key and your region has concurrency-checks-enabled turned off you will not receive invalidation events from your interest subscription for that key. When concurrency-checks-enabled is turned on GemFire will accept invalidation and deliver these events to your client cache.
- Parameters:
iterable- TheIterableof keys on which to register interest.policy- The interest result policy. This can be one of:- InterestResultPolicy.NONE - does not initialize the local cache
- InterestResultPolicy.KEYS - initializes the local cache with the keys satisfying the request
- InterestResultPolicy.KEYS_VALUES - initializes the local cache with the keys and current values satisfying the request
isDurable- true if the register interest is durable- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subcriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- Geode 1.5
- See Also:
InterestResultPolicy
-
registerInterestForKeys
default void registerInterestForKeys(java.lang.Iterable<K> iterable, InterestResultPolicy policy, boolean isDurable, boolean receiveValues)
Sends a request to the CacheServer to register interest for all key in the iterable for this client. Updates to any of the keys in the iterable by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. The keys are first locally cleared from the client and current value for the keys are inserted into the local cache before this call returns. (if requested).If you locally-destroy a key and your region has concurrency-checks-enabled turned off you will not receive invalidation events from your interest subscription for that key. When concurrency-checks-enabled is turned on GemFire will accept invalidation and deliver these events to your client cache.
- Parameters:
iterable- TheIterableof keys on which to register interest.policy- The interest result policy. This can be one of:- InterestResultPolicy.NONE - does not initialize the local cache
- InterestResultPolicy.KEYS - initializes the local cache with the keys satisfying the request
- InterestResultPolicy.KEYS_VALUES - initializes the local cache with the keys and current values satisfying the request
isDurable- true if the register interest is durablereceiveValues- defaults to true. set to false to receive create or update events as invalidates similar to notify-by-subscription false.- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subcriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- Geode 1.5
- See Also:
InterestResultPolicy
-
registerInterestRegex
void registerInterestRegex(java.lang.String regex)
Sends a request to the CacheServer to register interest in a regular expression pattern for this client. Updates to any keys of typeStringsatisfying this regular expression by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. These keys are first locally cleared from the client and the current values for keys of typeStringthat satisfy the regular expression are inserted into the local cache before this call returns.Note that if the
regexis".*"then all keys of any type will be pushed to the client.This method uses the default
InterestResultPolicy.The regular expression string is compiled using the
Patternclass.If you locally-destroy a key and your region has concurrency-checks-enabled turned off you will not receive invalidation events from your interest subscription for that key. When concurrency-checks-enabled is turned on GemFire will accept invalidation and deliver these events to your client cache.
- Parameters:
regex- The regular expression on which to register interest.- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subscriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- GemFire 4.2.3
- See Also:
InterestResultPolicy,Pattern
-
registerInterestRegex
void registerInterestRegex(java.lang.String regex, InterestResultPolicy policy)Sends a request to the CacheServer to register interest in a regular expression pattern for this client. Updates to any keys of typeStringsatisfying this regular expression by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. These keys are first locally cleared from the client and the current values for keys of typeStringthat satisfy the regular expression are inserted into the local cache before this call returns.The regular expression string is compiled using the
Patternclass.If you locally-destroy a key and your region has concurrency-checks-enabled turned off you will not receive invalidation events from your interest subscription for that key. When concurrency-checks-enabled is turned on GemFire will accept invalidation and deliver these events to your client cache.
- Parameters:
regex- The regular expression on which to register interest.policy- The interest result policy. This can be one of:- InterestResultPolicy.NONE - does not initialize the local cache
- InterestResultPolicy.KEYS - initializes the local cache with the keys satisfying the request
- InterestResultPolicy.KEYS_VALUES - initializes the local cache with the keys and current values satisfying the request
- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subscriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- GemFire 4.2.3
- See Also:
InterestResultPolicy,Pattern
-
unregisterInterest
void unregisterInterest(K key)
Sends a request to the CacheServer to unregister interest in a key for this client. Updates to this key by other clients will be no longer be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology.- Parameters:
key- The key on which to register interest. If the key is aList, then all the keys in theListwill be unregistered.- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.- Since:
- GemFire 4.2
-
unregisterInterestRegex
void unregisterInterestRegex(java.lang.String regex)
Sends a request to the CacheServer to unregister interest in a regular expression pattern for this client. Updates to any keys satisfying this regular expression by other clients will no longer be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology.- Parameters:
regex- The regular expression on which to unregister interest.- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.- Since:
- GemFire 4.2.3
-
getInterestList
java.util.List<K> getInterestList()
Returns the list of keys on which this client is interested and will be notified of changes. This method is currently supported only on clients in a client server topology.- Returns:
- The list of keys on which this client is interested
- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.- Since:
- GemFire 4.2
-
registerInterest
void registerInterest(K key, boolean isDurable)
Sends a request to the CacheServer to register interest in a key for this client. Updates to this key by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. This key is first locally cleared from the client and the current value for this key is inserted into the local cache before this call returns.- Parameters:
key- The key on which to register interest.###Deprecated behavior###
The following
Listand 'ALL_KEYS' behavior is now deprecated. As an alternative, please useregisterInterestForKeys(Iterable, InterestResultPolicy)registerInterestForAllKeys(InterestResultPolicy)If the key is a
List, then all the keys in theListwill be registered. The key can also be the special token 'ALL_KEYS', which will register interest in all keys in the region. In effect, this will cause an update to any key in this region in the CacheServer to be pushed to the client.Using 'ALL_KEYS' is the same as calling
registerInterestRegex(String)with ".*" as the argument. This means that all keys of any type are pushed to the client and inserted into the local cache.###End of deprecation###
This method uses the default
InterestResultPolicy.If you locally-destroy a key and your region has concurrency-checks-enabled turned off you will not receive invalidation events from your interest subscription for that key. When concurrency-checks-enabled is turned on GemFire will accept invalidation and deliver these events to your client cache.
isDurable- true if the register interest is durable- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subscriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- GemFire 5.5
- See Also:
InterestResultPolicy
-
registerInterest
void registerInterest(K key, boolean isDurable, boolean receiveValues)
Sends a request to the CacheServer to register interest in a key for this client. Updates to this key by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. This key is first locally cleared from the client and the current value for this key is inserted into the local cache before this call returns.If you locally-destroy a key and your region has concurrency-checks-enabled turned off you will not receive invalidation events from your interest subscription for that key. When concurrency-checks-enabled is turned on GemFire will accept invalidation and deliver these events to your client cache.
- Parameters:
key- The key on which to register interest.###Deprecated behavior###
The following
Listand 'ALL_KEYS' behavior is now deprecated. As an alternative, please useregisterInterestForKeys(Iterable, InterestResultPolicy)registerInterestForAllKeys(InterestResultPolicy)If the key is a
List, then all the keys in theListwill be registered. The key can also be the special token 'ALL_KEYS', which will register interest in all keys in the region. In effect, this will cause an update to any key in this region in the CacheServer to be pushed to the client.Using 'ALL_KEYS' is the same as calling
registerInterestRegex(String)with ".*" as the argument. This means that all keys of any type are pushed to the client and inserted into the local cache.###End of deprecation###
This method uses the default
InterestResultPolicy.isDurable- true if the register interest is durablereceiveValues- defaults to true. set to false to receive create or update events as invalidates similar to notify-by-subscription false.- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subscriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- GemFire 6.0.3
- See Also:
InterestResultPolicy
-
registerInterest
void registerInterest(K key, InterestResultPolicy policy, boolean isDurable, boolean receiveValues)
Sends a request to the CacheServer to register interest in a key for this client. Updates to this key by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. This key is first locally cleared from the client and the current value for this key is inserted into the local cache before this call returns (if requested).If you locally-destroy a key and your region has concurrency-checks-enabled turned off you will not receive invalidation events from your interest subscription for that key. When concurrency-checks-enabled is turned on GemFire will accept invalidation and deliver these events to your client cache.
- Parameters:
key- The key on which to register interest.###Deprecated behavior###
The following
Listand 'ALL_KEYS' behavior is now deprecated. As an alternative, please useregisterInterestForKeys(Iterable, InterestResultPolicy)registerInterestForAllKeys(InterestResultPolicy)If the key is a
List, then all the keys in theListwill be registered. The key can also be the special token 'ALL_KEYS', which will register interest in all keys in the region. In effect, this will cause an update to any key in this region in the CacheServer to be pushed to the client.Using 'ALL_KEYS' is the same as calling
registerInterestRegex(String)with ".*" as the argument. This means that all keys of any type are pushed to the client and inserted into the local cache.###End of deprecation###
policy- The interest result policy. This can be one of:- InterestResultPolicy.NONE - does not initialize the local cache
- InterestResultPolicy.KEYS - initializes the local cache with the keys satisfying the request
- InterestResultPolicy.KEYS_VALUES - initializes the local cache with the keys and current values satisfying the request
isDurable- true if the register interest is durablereceiveValues- defaults to true. set to false to receive create or update events as invalidates similar to notify-by-subscription false.- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subscriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- GemFire 6.0.3
- See Also:
InterestResultPolicy
-
registerInterest
void registerInterest(K key, InterestResultPolicy policy, boolean isDurable)
Sends a request to the CacheServer to register interest in a key for this client. Updates to this key by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. This key is first locally cleared from the client and the current value for this key is inserted into the local cache before this call returns (if requested).- Parameters:
key- The key on which to register interest.###Deprecated behavior###
The following
Listand 'ALL_KEYS' behavior is now deprecated. As an alternative, please useregisterInterestForKeys(Iterable, InterestResultPolicy)registerInterestForAllKeys(InterestResultPolicy)If the key is a
List, then all the keys in theListwill be registered. The key can also be the special token 'ALL_KEYS', which will register interest in all keys in the region. In effect, this will cause an update to any key in this region in the CacheServer to be pushed to the client.Using 'ALL_KEYS' is the same as calling
registerInterestRegex(String)with ".*" as the argument. This means that all keys of any type are pushed to the client and inserted into the local cache.###End of deprecation###
If you locally-destroy a key and your region has concurrency-checks-enabled turned off you will not receive invalidation events from your interest subscription for that key. When concurrency-checks-enabled is turned on GemFire will accept invalidation and deliver these events to your client cache.
policy- The interest result policy. This can be one of:- InterestResultPolicy.NONE - does not initialize the local cache
- InterestResultPolicy.KEYS - initializes the local cache with the keys satisfying the request
- InterestResultPolicy.KEYS_VALUES - initializes the local cache with the keys and current values satisfying the request
isDurable- true if the register interest is durable- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subscriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- GemFire 5.5
- See Also:
InterestResultPolicy
-
registerInterestRegex
void registerInterestRegex(java.lang.String regex, boolean isDurable)Sends a request to the CacheServer to register interest in a regular expression pattern for this client. Updates to any keys of typeStringsatisfying this regular expression by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. These keys are first locally cleared from the client and the current values for keys of typeStringthat satisfy the regular expression are inserted into the local cache before this call returns.If you locally-destroy a key and your region has concurrency-checks-enabled turned off you will not receive invalidation events from your interest subscription for that key. When concurrency-checks-enabled is turned on GemFire will accept invalidation and deliver these events to your client cache.
Note that if the
regexis".*"then all keys of any type will be pushed to the client.This method uses the default
InterestResultPolicy.The regular expression string is compiled using the
Patternclass.- Parameters:
regex- The regular expression on which to register interest.isDurable- true if the register interest is durable- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subscriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- GemFire 5.5
- See Also:
InterestResultPolicy,Pattern
-
registerInterestRegex
void registerInterestRegex(java.lang.String regex, boolean isDurable, boolean receiveValues)Sends a request to the CacheServer to register interest in a regular expression pattern for this client. Updates to any keys of typeStringsatisfying this regular expression by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. These keys are first locally cleared from the client and the current values for keys of typeStringthat satisfy the regular expression are inserted into the local cache before this call returns.Note that if the
regexis".*"then all keys of any type will be pushed to the client.This method uses the default
InterestResultPolicy.The regular expression string is compiled using the
Patternclass.If you locally-destroy a key and your region has concurrency-checks-enabled turned off you will not receive invalidation events from your interest subscription for that key. When concurrency-checks-enabled is turned on GemFire will accept invalidation and deliver these events to your client cache.
- Parameters:
regex- The regular expression on which to register interest.isDurable- true if the register interest is durablereceiveValues- defaults to true. set to false to receive create or update events as invalidates similar to notify-by-subscription false.- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subscriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- GemFire 6.0.3
- See Also:
InterestResultPolicy,Pattern
-
registerInterestRegex
void registerInterestRegex(java.lang.String regex, InterestResultPolicy policy, boolean isDurable)Sends a request to the CacheServer to register interest in a regular expression pattern for this client. Updates to any keys of typeStringsatisfying this regular expression by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. These keys are first locally cleared from the client and the current values for keys of typeStringthat satisfy the regular expression are inserted into the local cache before this call returns.The regular expression string is compiled using the
Patternclass.If you locally-destroy a key and your region has concurrency-checks-enabled turned off you will not receive invalidation events from your interest subscription for that key. When concurrency-checks-enabled is turned on GemFire will accept invalidation and deliver these events to your client cache.
- Parameters:
regex- The regular expression on which to register interest.policy- The interest result policy. This can be one of:- InterestResultPolicy.NONE - does not initialize the local cache
- InterestResultPolicy.KEYS - initializes the local cache with the keys satisfying the request
- InterestResultPolicy.KEYS_VALUES - initializes the local cache with the keys and current values satisfying the request
isDurable- true if the register interest is durable- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subscriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- GemFire 5.5
- See Also:
InterestResultPolicy,Pattern
-
registerInterestRegex
void registerInterestRegex(java.lang.String regex, InterestResultPolicy policy, boolean isDurable, boolean receiveValues)Sends a request to the CacheServer to register interest in a regular expression pattern for this client. Updates to any keys of typeStringsatisfying this regular expression by other clients will be pushed to this client by the CacheServer. This method is currently supported only on clients in a client server topology. These keys are first locally cleared from the client and the current values for keys of typeStringthat satisfy the regular expression are inserted into the local cache before this call returns.The regular expression string is compiled using the
Patternclass.If you locally-destroy a key and your region has concurrency-checks-enabled turned off you will not receive invalidation events from your interest subscription for that key. When concurrency-checks-enabled is turned on GemFire will accept invalidation and deliver these events to your client cache.
- Parameters:
regex- The regular expression on which to register interest.policy- The interest result policy. This can be one of:- InterestResultPolicy.NONE - does not initialize the local cache
- InterestResultPolicy.KEYS - initializes the local cache with the keys satisfying the request
- InterestResultPolicy.KEYS_VALUES - initializes the local cache with the keys and current values satisfying the request
isDurable- true if the register interest is durablereceiveValues- defaults to true. set to false to receive create or update events as invalidates similar to notify-by-subscription false.- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.SubscriptionNotEnabledException- if the region's pool does not have subscriptions enabled.java.lang.UnsupportedOperationException- if the region is a replicate with distributed scope.- Since:
- GemFire 6.0.3
- See Also:
InterestResultPolicy,Pattern
-
getInterestListRegex
java.util.List<java.lang.String> getInterestListRegex()
Returns the list of regular expresssions on which this client is interested and will be notified of changes. This method is currently supported only on clients in a client server topology.- Returns:
- The list of regular expresssions on which this client is interested
- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.- Since:
- GemFire 4.2.3
-
keySetOnServer
java.util.Set<K> keySetOnServer()
Returns a set of keys in the region on the server.- Returns:
- a Set of all the keys in the region on the server
- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.- Since:
- GemFire 5.0.2
-
containsKeyOnServer
boolean containsKeyOnServer(java.lang.Object key)
Returns whether the specified key currently exists in this region on the server.- Parameters:
key- the key to check for an existing entry- Returns:
- true if there is an entry in this region for the specified key on the server
- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.- Since:
- GemFire 5.0.2
-
sizeOnServer
int sizeOnServer()
Returns the number of entries present in this region on the server. Entries stored in this client region are ignored.- Returns:
- the number of entries present in this region on the server.
- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.- Since:
- Geode 1.2.0
-
isEmptyOnServer
boolean isEmptyOnServer()
Returns true if this region contains no entries on the server.- Returns:
- true if this region contains no entries on the server.
- Throws:
java.lang.UnsupportedOperationException- if the region is not configured with a pool name.- Since:
- Geode 1.2.0
-
putIfAbsent
V putIfAbsent(K key, V value)
If the specified key is not already associated with a value, associate it with the given value. This is equivalent toif (!map.containsKey(key)) return map.put(key, value); else return map.get(key);
except that the action is performed atomically.ConcurrentMap operations are supported on partitioned and replicated regions and in client caches. They are also supported on non-empty local regions.
Please read the notes on ConcurrentMap operations in the javadoc for Region.
Region allows the value parameter to be null, which will create an invalid entry.
- Specified by:
putIfAbsentin interfacejava.util.concurrent.ConcurrentMap<K,V>- Specified by:
putIfAbsentin interfacejava.util.Map<K,V>- Parameters:
key- key with which the specified value is to be associatedvalue- value to be associated with the specified key- Returns:
- the previous value associated with the specified key, or
nullif there was no mapping for the key. (Anullreturn can also indicate that the map previously associatednullwith the key, if the implementation supports null values.) - Throws:
java.lang.UnsupportedOperationException- if theputoperation is not supported by this mapjava.lang.ClassCastException- if the class of the specified key or value prevents it from being stored in this mapjava.lang.NullPointerException- if the specified key or value is null, and this map does not permit null keys or valuesjava.lang.IllegalArgumentException- if some property of the specified key or value prevents it from being stored in this mapLeaseExpiredException- if lease expired on distributed lock for Scope.GLOBALTimeoutException- if timed out getting distributed lock for Scope.GLOBALCacheWriterException- if a CacheWriter aborts the operationPartitionedRegionStorageException- if the operation could not be completed on a partitioned region.LowMemoryException- if a low memory condition is detected.- Since:
- GemFire 6.5
-
remove
boolean remove(java.lang.Object key, java.lang.Object value)Removes the entry for a key only if currently mapped to a given value. This is equivalent toif (map.containsKey(key) && map.get(key).equals(value)) { map.remove(key); return true; } else return false;except that the action is performed atomically.As of 8.5, if value is an Array then Arrays.equals or Arrays.deepEquals is used instead of Object.equals.
ConcurrentMap operations are supported on partitioned and replicated regions and in client caches. They are also supported on non-empty local regions.
Please read the notes on ConcurrentMap operations in the javadoc for Region.
Region allows the value parameter to be null, which will match an invalid entry.
- Specified by:
removein interfacejava.util.concurrent.ConcurrentMap<K,V>- Specified by:
removein interfacejava.util.Map<K,V>- Parameters:
key- key with which the specified value is associatedvalue- value expected to be associated with the specified key- Returns:
trueif the value was removed- Throws:
java.lang.UnsupportedOperationException- if theremoveoperation is not supported by this mapjava.lang.ClassCastException- if the key or value is of an inappropriate type for this map (optional)java.lang.NullPointerException- if the specified key or value is null, and this map does not permit null keys or values (optional)LeaseExpiredException- if lease expired on distributed lock for Scope.GLOBALTimeoutException- if timed out getting distributed lock for Scope.GLOBALCacheWriterException- if a CacheWriter aborts the operationPartitionedRegionStorageException- if the operation could not be completed on a partitioned region.LowMemoryException- if a low memory condition is detected.- Since:
- GemFire 6.5
-
replace
boolean replace(K key, V oldValue, V newValue)
Replaces the entry for a key only if currently mapped to a given value. This is equivalent toif (map.containsKey(key) && map.get(key).equals(oldValue)) { map.put(key, newValue); return true; } else return false;except that the action is performed atomically.As of 8.5, if value is an Array then Arrays.equals or Arrays.deepEquals is used instead of Object.equals.
ConcurrentMap operations are supported on partitioned and replicated regions and in client caches. They are also supported on non-empty local regions.
Please read the notes on ConcurrentMap operations in the javadoc for Region.
Region allows the oldValue parameter to be null, which will match an invalid entry.
- Specified by:
replacein interfacejava.util.concurrent.ConcurrentMap<K,V>- Specified by:
replacein interfacejava.util.Map<K,V>- Parameters:
key- key with which the specified value is associatedoldValue- value expected to be associated with the specified keynewValue- value to be associated with the specified key- Returns:
trueif the value was replaced- Throws:
java.lang.UnsupportedOperationException- if thereplaceoperation is not supported by this mapjava.lang.ClassCastException- if the class of a specified key or value prevents it from being stored in this mapjava.lang.NullPointerException- if a specified key is null, and this map does not permit null keysjava.lang.IllegalArgumentException- if some property of a specified key or value prevents it from being stored in this mapLeaseExpiredException- if lease expired on distributed lock for Scope.GLOBALTimeoutException- if timed out getting distributed lock for Scope.GLOBALCacheWriterException- if a CacheWriter aborts the operationPartitionedRegionStorageException- if the operation could not be completed on a partitioned region.LowMemoryException- if a low memory condition is detected.- Since:
- GemFire 6.5
-
replace
V replace(K key, V value)
Replaces the entry for a key only if currently mapped to some value. This is equivalent toif (map.containsKey(key)) { return map.put(key, value); } else return null;except that the action is performed atomically.ConcurrentMap operations are supported on partitioned and replicated regions and in client caches. They are also supported on non-empty local regions.
Please read the notes on ConcurrentMap operations in the javadoc for Region.
- Specified by:
replacein interfacejava.util.concurrent.ConcurrentMap<K,V>- Specified by:
replacein interfacejava.util.Map<K,V>- Parameters:
key- key with which the specified value is associatedvalue- value to be associated with the specified key- Returns:
- the previous value associated with the specified key, or
nullif there was no mapping for the key. (Anullreturn can also indicate that the map previously associatednullwith the key, if the implementation supports null values.) - Throws:
java.lang.UnsupportedOperationException- if theputoperation is not supported by this mapjava.lang.ClassCastException- if the class of the specified key or value prevents it from being stored in this mapjava.lang.NullPointerException- if the specified key or value is null, and this map does not permit null keys or valuesjava.lang.IllegalArgumentException- if some property of the specified key or value prevents it from being stored in this mapLeaseExpiredException- if lease expired on distributed lock for Scope.GLOBALTimeoutException- if timed out getting distributed lock for Scope.GLOBALCacheWriterException- if a CacheWriter aborts the operationPartitionedRegionStorageException- if the operation could not be completed on a partitioned region.LowMemoryException- if a low memory condition is detected.- Since:
- GemFire 6.5
-
-