GemFire 5.5

com.gemstone.gemfire.cache
Interface AttributesMutator


public interface AttributesMutator

Supports modification of certain region attributes after the region has been created. It is recommended that the attributes be completely initialized using an AttributesFactory before creating the region instead of using an AttributesMutator after region creation. This will avoid a potential performance penalty due to the additional network traffic.

The setter methods all return the previous value of the attribute.

Since:
3.0
See Also:
Region.getAttributesMutator(), RegionAttributes, AttributesFactory

Method Summary
 void addCacheListener(CacheListener aListener)
          Adds a cache listener to the end of the list of cache listeners on this region.
 EvictionAttributesMutator getEvictionAttributesMutator()
          Allows changing the eviction controller attributes for the region.
 Region getRegion()
          Returns the Region whose attributes this mutator affects.
 void initCacheListeners(CacheListener[] newListeners)
          Removes all cache listeners, calling CacheCallback.close() on each of them, and then adds each listener in the specified array.
 void removeCacheListener(CacheListener aListener)
          Removes a cache listener from the list of cache listeners on this region.
 CacheListener setCacheListener(CacheListener aListener)
          Deprecated. as of GemFire 5.0, use addCacheListener(com.gemstone.gemfire.cache.CacheListener) or initCacheListeners(com.gemstone.gemfire.cache.CacheListener[]) instead.
 CacheLoader setCacheLoader(CacheLoader cacheLoader)
          Changes the cache loader for the region.
 CacheWriter setCacheWriter(CacheWriter cacheWriter)
          Changes the cache writer for the region.
 ExpirationAttributes setEntryIdleTimeout(ExpirationAttributes idleTimeout)
          Changes the idleTimeout expiration attributes for values in the region.
 ExpirationAttributes setEntryTimeToLive(ExpirationAttributes timeToLive)
          Changes the timeToLive expiration attributes for values in this region.
 ExpirationAttributes setRegionIdleTimeout(ExpirationAttributes idleTimeout)
          Changes the idleTimeout expiration attributes for the region as a whole.
 ExpirationAttributes setRegionTimeToLive(ExpirationAttributes timeToLive)
          Changes the timeToLive expiration attributes for the region as a whole
 

Method Detail

getRegion

Region getRegion()
Returns the Region whose attributes this mutator affects.

Returns:
the Region this mutator affects

setRegionTimeToLive

ExpirationAttributes setRegionTimeToLive(ExpirationAttributes timeToLive)
Changes the timeToLive expiration attributes for the region as a whole

Parameters:
timeToLive - the expiration attributes for the region timeToLive
Returns:
the previous value of region timeToLive
Throws:
IllegalArgumentException - if timeToLive is null or if the ExpirationAction is LOCAL_INVALIDATE and the region is replicated
IllegalStateException - if statistics are disabled for this region.

setRegionIdleTimeout

ExpirationAttributes setRegionIdleTimeout(ExpirationAttributes idleTimeout)
Changes the idleTimeout expiration attributes for the region as a whole. Resets the CacheStatistics.getLastAccessedTime() for the region.

Parameters:
idleTimeout - the ExpirationAttributes for this region idleTimeout
Returns:
the previous value of region idleTimeout
Throws:
IllegalArgumentException - if idleTimeout is null or if the ExpirationAction is LOCAL_INVALIDATE and the region is replicated
IllegalStateException - if statistics are disabled for this region.

setEntryTimeToLive

ExpirationAttributes setEntryTimeToLive(ExpirationAttributes timeToLive)
Changes the timeToLive expiration attributes for values in this region.

Parameters:
timeToLive - the timeToLive expiration attributes for entries
Returns:
the previous value of entry timeToLive
Throws:
IllegalArgumentException - if timeToLive is null or if the ExpirationAction is LOCAL_DESTROY and the region is replicated or if the ExpirationAction is LOCAL_INVALIDATE and the region is replicated
IllegalStateException - if statistics are disabled for this region.

setEntryIdleTimeout

ExpirationAttributes setEntryIdleTimeout(ExpirationAttributes idleTimeout)
Changes the idleTimeout expiration attributes for values in the region.

Parameters:
idleTimeout - the idleTimeout expiration attributes for entries
Returns:
the previous value of entry idleTimeout
Throws:
IllegalArgumentException - if idleTimeout is null or if the ExpirationAction is LOCAL_DESTROY and the region is replicated or if the the ExpirationAction is LOCAL_INVALIDATE and the region is replicated
IllegalStateException - if statistics are disabled for this region.
See Also:
AttributesFactory.setStatisticsEnabled(boolean)

setCacheListener

CacheListener setCacheListener(CacheListener aListener)
Deprecated. as of GemFire 5.0, use addCacheListener(com.gemstone.gemfire.cache.CacheListener) or initCacheListeners(com.gemstone.gemfire.cache.CacheListener[]) instead.

Changes the CacheListener for the region. Removes listeners already added and calls CacheCallback.close() on each of them.

Parameters:
aListener - a user defined cache listener
Returns:
the previous CacheListener if a single one exists; otherwise null.
Throws:
IllegalStateException - if more than one cache listener has already been added

addCacheListener

void addCacheListener(CacheListener aListener)
Adds a cache listener to the end of the list of cache listeners on this region.

Parameters:
aListener - the user defined cache listener to add to the region.
Throws:
IllegalArgumentException - if aListener is null
Since:
5.0

removeCacheListener

void removeCacheListener(CacheListener aListener)
Removes a cache listener from the list of cache listeners on this region. Does nothing if the specified listener has not been added. If the specified listener has been added then CacheCallback.close() will be called on it; otherwise does nothing.

Parameters:
aListener - the cache listener to remove from the region.
Throws:
IllegalArgumentException - if aListener is null
Since:
5.0

initCacheListeners

void initCacheListeners(CacheListener[] newListeners)
Removes all cache listeners, calling CacheCallback.close() on each of them, and then adds each listener in the specified array.

Parameters:
newListeners - a possibly null or empty array of listeners to add to this region.
Throws:
IllegalArgumentException - if the newListeners array has a null element
Since:
5.0

setCacheWriter

CacheWriter setCacheWriter(CacheWriter cacheWriter)
Changes the cache writer for the region.

Parameters:
cacheWriter - the cache writer
Returns:
the previous CacheWriter

setCacheLoader

CacheLoader setCacheLoader(CacheLoader cacheLoader)
Changes the cache loader for the region.

Parameters:
cacheLoader - the cache loader
Returns:
the previous CacheLoader

getEvictionAttributesMutator

EvictionAttributesMutator getEvictionAttributesMutator()
Allows changing the eviction controller attributes for the region.

Returns:
the EvictionAttributesMutator used to change the EvictionAttributes

GemFire 5.5

Copyright © 2002-2008 GemStone Systems, Inc. All Rights Reserved.