Class ClientRegionFactoryBean<K,V>

All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean<org.apache.geode.cache.Region<K,V>>, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, EvictingRegionFactoryBean, ExpiringRegionFactoryBean<K,V>, SmartLifecycleSupport

public class ClientRegionFactoryBean<K,V> extends ConfigurableRegionFactoryBean<K,V> implements SmartLifecycleSupport, EvictingRegionFactoryBean, ExpiringRegionFactoryBean<K,V>, org.springframework.beans.factory.DisposableBean
Spring FactoryBean used to construct, configure and initialize a client Region.
See Also:
  • Field Details

  • Constructor Details

    • ClientRegionFactoryBean

      public ClientRegionFactoryBean()
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Initializes a the instance of ClientRegionFactoryBean.
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Overrides:
      afterPropertiesSet in class ConfigurableRegionFactoryBean<K,V>
      Throws:
      Exception - if initialization fails.
      See Also:
    • createRegion

      protected org.apache.geode.cache.Region<K,V> createRegion(org.apache.geode.cache.GemFireCache gemfireCache, String regionName)
      Creates a new Region with the given name.
      Overrides:
      createRegion in class ResolvableRegionFactoryBean<K,V>
      Parameters:
      gemfireCache - reference to the GemFireCache.
      regionName - name of the new Region.
      Returns:
      a new Region with the given name.
      See Also:
    • createClientRegionFactory

      protected org.apache.geode.cache.client.ClientRegionFactory<K,V> createClientRegionFactory(org.apache.geode.cache.client.ClientCache clientCache, org.apache.geode.cache.client.ClientRegionShortcut clientRegionShortcut)
      Constructs a new instance of ClientRegionFactory using the given ClientCache and ClientRegionShortcut.
      Parameters:
      clientCache - reference to the ClientCache.
      clientRegionShortcut - ClientRegionShortcut used to configure the client Region DataPolicy.
      Returns:
      a new instance of ClientRegionFactory.
      See Also:
      • ClientCache.createClientRegionFactory(ClientRegionShortcut)
      • ClientRegionShortcut
      • ClientRegionFactory
    • configure

      protected org.apache.geode.cache.client.ClientRegionFactory<K,V> configure(org.apache.geode.cache.client.ClientRegionFactory<K,V> clientRegionFactory)
      Configures the given ClientRegionFactoryBean from the configuration settings of this ClientRegionFactoryBean and any RegionAttributes.
      Parameters:
      clientRegionFactory - ClientRegionFactory to configure.
      Returns:
      the configured ClientRegionFactory.
      See Also:
      • ClientRegionFactory
    • postProcess

      protected org.apache.geode.cache.client.ClientRegionFactory<K,V> postProcess(org.apache.geode.cache.client.ClientRegionFactory<K,V> clientRegionFactory)
      Post-process the given ClientRegionFactory setup by this ClientRegionFactoryBean.
      Parameters:
      clientRegionFactory - ClientRegionFactory to process.
      Returns:
      the given ClientRegionFactory.
      See Also:
      • ClientRegionFactory
    • postProcess

      protected org.apache.geode.cache.Region<K,V> postProcess(org.apache.geode.cache.Region<K,V> region)
      Post-process the Region created by this ClientRegionFactoryBean.
      Overrides:
      postProcess in class ResolvableRegionFactoryBean<K,V>
      Parameters:
      region - Region to process.
      See Also:
      • Region
    • start

      public void start()
      Registers interests in the startup lifecycle phase of the Spring container.
      Specified by:
      start in interface org.springframework.context.Lifecycle
      See Also:
    • destroy

      public void destroy() throws Exception
      Closes and destroys the Region.
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
      Throws:
      Exception - if destroy fails.
      See Also:
      • DisposableBean
    • setAttributes

      public void setAttributes(org.apache.geode.cache.RegionAttributes<K,V> attributes)
      Sets the region attributes used for the region used by this factory. Allows maximum control in specifying the region settings. Used only when a new region is created. Note that using this method allows for advanced customization of the region - while it provides a lot of flexibility, note that it's quite easy to create misconfigured regions (especially in a client/server scenario).
      Parameters:
      attributes - the attributes to set on a newly created region
    • getAttributes

      protected org.apache.geode.cache.RegionAttributes<K,V> getAttributes()
      Gets the RegionAttributes used to configure the client Region created by this ClientRegionFactoryBean.
      Returns:
      the RegionAttributes used to configure the client Region.
      See Also:
      • RegionAttributes
    • setCacheListeners

      public void setCacheListeners(org.apache.geode.cache.CacheListener<K,V>[] cacheListeners)
      Sets the cache listeners used for the region used by this factory. Used only when a new region is created.Overrides the settings specified through setAttributes(RegionAttributes).
      Parameters:
      cacheListeners - the cacheListeners to set on a newly created region
    • setCacheLoader

      public void setCacheLoader(org.apache.geode.cache.CacheLoader<K,V> cacheLoader)
      Sets the CacheLoader used to load data local to the client's Region on cache misses.
      Parameters:
      cacheLoader - a GemFire CacheLoader used to load data into the client Region.
      See Also:
      • CacheLoader
    • setCacheWriter

      public void setCacheWriter(org.apache.geode.cache.CacheWriter<K,V> cacheWriter)
      Sets the CacheWriter used to perform a synchronous write-behind when data is put into the client's Region.
      Parameters:
      cacheWriter - the GemFire CacheWriter used to perform synchronous write-behinds on put ops.
      See Also:
      • CacheWriter
    • setCloningEnabled

      public void setCloningEnabled(Boolean cloningEnabled)
    • setClose

      public void setClose(boolean close)
      Indicates whether the region referred by this factory bean will be closed on shutdown (default true). Note: destroy and close are mutually exclusive. Enabling one will automatically disable the other.
      Parameters:
      close - whether to close or not the region
      See Also:
    • setCompressor

      public void setCompressor(org.apache.geode.compression.Compressor compressor)
      Configures the Compressor used to compress the this Region's data.
      Parameters:
      compressor - Compressor used to compress the this Region's data.
      See Also:
      • Compressor
    • setConcurrencyChecksEnabled

      public void setConcurrencyChecksEnabled(Boolean concurrencyChecksEnabled)
    • setConcurrencyLevel

      public void setConcurrencyLevel(Integer concurrencyLevel)
    • setCustomEntryIdleTimeout

      public void setCustomEntryIdleTimeout(org.apache.geode.cache.CustomExpiry<K,V> customEntryIdleTimeout)
      Specified by:
      setCustomEntryIdleTimeout in interface ExpiringRegionFactoryBean<K,V>
    • setCustomEntryTimeToLive

      public void setCustomEntryTimeToLive(org.apache.geode.cache.CustomExpiry<K,V> customEntryTimeToLive)
      Specified by:
      setCustomEntryTimeToLive in interface ExpiringRegionFactoryBean<K,V>
    • setDataPolicy

      public void setDataPolicy(org.apache.geode.cache.DataPolicy dataPolicy)
      Sets the Data Policy. Used only when a new Region is created.
      Parameters:
      dataPolicy - the client Region's Data Policy.
      See Also:
      • DataPolicy
    • setDestroy

      public void setDestroy(boolean destroy)
      Indicates whether the region referred by this factory bean will be destroyed on shutdown (default false). Note: destroy and close are mutually exclusive. Enabling one will automatically disable the other.
      Parameters:
      destroy - whether or not to destroy the region
      See Also:
    • setDiskStoreName

      public void setDiskStoreName(String diskStoreName)
      Sets the name of disk store to use for overflow and persistence
      Parameters:
      diskStoreName - a String specifying the 'name' of the client Region Disk Store.
    • setDiskSynchronous

      public void setDiskSynchronous(Boolean diskSynchronous)
    • setEntryIdleTimeout

      public void setEntryIdleTimeout(org.apache.geode.cache.ExpirationAttributes entryIdleTimeout)
      Specified by:
      setEntryIdleTimeout in interface ExpiringRegionFactoryBean<K,V>
    • setEntryTimeToLive

      public void setEntryTimeToLive(org.apache.geode.cache.ExpirationAttributes entryTimeToLive)
      Specified by:
      setEntryTimeToLive in interface ExpiringRegionFactoryBean<K,V>
    • setEvictionAttributes

      public void setEvictionAttributes(org.apache.geode.cache.EvictionAttributes evictionAttributes)
      Specified by:
      setEvictionAttributes in interface EvictingRegionFactoryBean
    • setInitialCapacity

      public void setInitialCapacity(Integer initialCapacity)
    • setInterests

      public void setInterests(Interest<K>[] interests)
      Set the interests for this client region. Both key and regex interest are supported.
      Parameters:
      interests - the interests to set
    • setKeyConstraint

      public void setKeyConstraint(Class<K> keyConstraint)
      Sets a type constraint on this client Region's keys.
      Parameters:
      keyConstraint - type of this client Region's keys.
      See Also:
    • setLoadFactor

      public void setLoadFactor(Float loadFactor)
    • isPersistent

      protected boolean isPersistent()
    • isNotPersistent

      protected boolean isNotPersistent()
    • setPersistent

      public void setPersistent(boolean persistent)
      Configures whether this client Region is persistent, i.e. stores data to disk.
      Parameters:
      persistent - boolean value used to enable disk persistence.
    • setPool

      public void setPool(org.apache.geode.cache.client.Pool pool)
      Configures the Pool used by this client Region.
      Parameters:
      pool - Pool used by this client Region to send/receive data to/from the server.
      See Also:
    • setPoolName

      public void setPoolName(String poolName)
      Configures the name of the Pool to be used by this client Region.
      Parameters:
      poolName - String containing the name of the client Pool to be used by this client Region.
      See Also:
    • getPoolName

      public Optional<String> getPoolName()
      Returns the name of the configured Pool used by this client Region.
      Returns:
      the Optional name of the configured Pool to be used by this client Region.
      See Also:
    • setPoolResolver

      public void setPoolResolver(@Nullable PoolResolver poolResolver)
      Sets (configures) the PoolResolver used by this client Region to resolve Pool objects. The Pool objects may be managed or un-managed depending on the PoolResolver implementation.
      Parameters:
      poolResolver - PoolResolver used to resolve the configured Pool.
      See Also:
    • getPoolResolver

      @NonNull public PoolResolver getPoolResolver()
      Gets the configured PoolResolver used by this client Region to resolve Pool objects.
      Returns:
      the configured PoolResolver. If no PoolResolver was configured, then return the default, PoolManagerPoolResolver.
      See Also:
    • getDefaultPoolResolver

      @NonNull public PoolResolver getDefaultPoolResolver()
      Gets a reference to the configured, default PoolResolver used by this client Region to resolve Pool objects if a explicit PoolResolver was not configured. The default PoolResolver uses a composition of the BeanFactoryPoolResolver and PoolManagerPoolResolver to fallback on.
      Returns:
      the default PoolResolver.
      See Also:
    • setRegionIdleTimeout

      public void setRegionIdleTimeout(org.apache.geode.cache.ExpirationAttributes regionIdleTimeout)
      Specified by:
      setRegionIdleTimeout in interface ExpiringRegionFactoryBean<K,V>
    • setRegionTimeToLive

      public void setRegionTimeToLive(org.apache.geode.cache.ExpirationAttributes regionTimeToLive)
      Specified by:
      setRegionTimeToLive in interface ExpiringRegionFactoryBean<K,V>
    • setShortcut

      public void setShortcut(org.apache.geode.cache.client.ClientRegionShortcut shortcut)
      Initializes the DataPolicy of the client Region using the given ClientRegionShortcut.
      Parameters:
      shortcut - ClientRegionShortcut used to initialize the DataPolicy of this client Region.
      See Also:
      • ClientRegionShortcut
    • setStatisticsEnabled

      public void setStatisticsEnabled(Boolean statisticsEnabled)
    • getStatisticsEnabled

      public Boolean getStatisticsEnabled()
    • isStatisticsEnabled

      public boolean isStatisticsEnabled()
    • resolveStatisticsEnabled

      protected boolean resolveStatisticsEnabled()
    • setValueConstraint

      public void setValueConstraint(Class<V> valueConstraint)
      Sets a type constraint on this client Region's values.
      Parameters:
      valueConstraint - type of this client Region's values.
      See Also: