Class CacheFactoryBean

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.GemFireCache>, org.springframework.beans.factory.InitializingBean, org.springframework.context.Phased, org.springframework.dao.support.PersistenceExceptionTranslator
Direct Known Subclasses:
ClientCacheFactoryBean

public class CacheFactoryBean extends AbstractResolvableCacheFactoryBean
Spring FactoryBean used to construct, configure and initialize a peer Cache instance. Allows either the retrieval of an existing, open Cache or the creation of a new Cache.
See Also:
  • Constructor Details

    • CacheFactoryBean

      public CacheFactoryBean()
  • Method Details

    • applyCacheConfigurers

      protected void applyCacheConfigurers()
      Applies the composite PeerCacheConfigurers to this CacheFactoryBean before the peer cache is created.
      Specified by:
      applyCacheConfigurers in class AbstractBasicCacheFactoryBean
      See Also:
    • applyPeerCacheConfigurers

      protected void applyPeerCacheConfigurers(PeerCacheConfigurer... peerCacheConfigurers)
      Applies the array of PeerCacheConfigurers to this CacheFactoryBean before the peer cache is created.
      Parameters:
      peerCacheConfigurers - array of PeerCacheConfigurers applied to this CacheFactoryBean.
      See Also:
    • applyPeerCacheConfigurers

      protected void applyPeerCacheConfigurers(Iterable<PeerCacheConfigurer> peerCacheConfigurers)
      Applies the Iterable of PeerCacheConfigurers to this CacheFactoryBean before the peer cache is created.
      Parameters:
      peerCacheConfigurers - Iterable of PeerCacheConfigurers applied to this CacheFactoryBean.
      See Also:
    • doFetchCache

      protected <T extends org.apache.geode.cache.GemFireCache> T doFetchCache()
      Description copied from class: AbstractBasicCacheFactoryBean
      Called by AbstractBasicCacheFactoryBean.fetchCache() if the GemFireCache reference returned by AbstractBasicCacheFactoryBean.getCache() is null. This method is typically implemented by calling CacheFactory.getAnyInstance() or ClientCacheFactory.getAnyInstance() depending on the GemFireCache type declared and used in the Spring application.
      Specified by:
      doFetchCache in class AbstractBasicCacheFactoryBean
      Type Parameters:
      T - parameterized Class type extending GemFireCache.
      Returns:
      a (existing) reference to a GemFireCache instance.
      See Also:
    • doGetObjectType

      protected Class<? extends org.apache.geode.cache.GemFireCache> doGetObjectType()
      Description copied from class: AbstractBasicCacheFactoryBean
      By default, returns GemFireCache Class.
      Overrides:
      doGetObjectType in class AbstractBasicCacheFactoryBean
      Returns:
      GemFireCache Class by default.
      See Also:
    • createFactory

      @NonNull protected Object createFactory(@NonNull Properties gemfireProperties)
      Constructs a new instance of CacheFactory initialized with the given Apache Geode Properties used to construct, configure and initialize a new peer Cache instance.
      Specified by:
      createFactory in class AbstractResolvableCacheFactoryBean
      Parameters:
      gemfireProperties - Properties used by the CacheFactory to configure the peer Cache.
      Returns:
      a new instance of CacheFactory initialized with the given Apache Geode Properties.
      See Also:
    • configureFactory

      @NonNull protected Object configureFactory(@NonNull Object factory)
      Configures the CacheFactory used to create the Cache.
      Overrides:
      configureFactory in class AbstractResolvableCacheFactoryBean
      Parameters:
      factory - CacheFactory used to create the Cache.
      Returns:
      the configured CacheFactory.
      See Also:
    • configurePdx

      @NonNull protected org.apache.geode.cache.CacheFactory configurePdx(@NonNull org.apache.geode.cache.CacheFactory cacheFactory)
      Configures the Cache to use PDX serialization.
      Parameters:
      cacheFactory - CacheFactory to configure with PDX.
      Returns:
      the given CacheFactory.
      See Also:
    • configureSecurity

      @NonNull protected org.apache.geode.cache.CacheFactory configureSecurity(@NonNull org.apache.geode.cache.CacheFactory cacheFactory)
      Configures the Cache with security.
      Parameters:
      cacheFactory - CacheFactory used to configure the peer Cache instance with security.
      Returns:
      the given CacheFactory.
      See Also:
      • CacheFactory
    • createCache

      @NonNull protected <T extends org.apache.geode.cache.GemFireCache> T createCache(@NonNull Object factory)
      Creates a new Cache instance using the provided factory.
      Specified by:
      createCache in class AbstractResolvableCacheFactoryBean
      Type Parameters:
      T - sub-type of GemFireCache.
      Parameters:
      factory - instance of CacheFactory.
      Returns:
      a new instance of Cache created by the provided factory.
      See Also:
      • CacheFactory.create()
      • GemFireCache
    • postProcess

      @NonNull protected <T extends org.apache.geode.cache.GemFireCache> T postProcess(@NonNull T cache)
      Post process the GemFireCache by loading any cache.xml file, applying custom settings specified in SDG XML configuration meta-data, and registering appropriate Transaction Listeners, Writer and JNDI settings along with JVM Heap configuration.
      Overrides:
      postProcess in class AbstractResolvableCacheFactoryBean
      Type Parameters:
      T - parameterized Class type extending GemFireCache.
      Parameters:
      cache - GemFireCache to post process.
      Returns:
      the given GemFireCache.
      See Also:
    • getCompositePeerCacheConfigurer

      @NonNull public PeerCacheConfigurer getCompositePeerCacheConfigurer()
      Returns a reference to the Composite PeerCacheConfigurer used to apply additional configuration to this CacheFactoryBean during Spring container initialization.
      Returns:
      the Composite PeerCacheConfigurer.
      See Also:
    • setEnableAutoReconnect

      public void setEnableAutoReconnect(@Nullable Boolean enableAutoReconnect)
      Controls whether auto-reconnect functionality introduced in GemFire 8 is enabled or not.
      Parameters:
      enableAutoReconnect - a boolean value to enable/disable auto-reconnect functionality.
      Since:
      GemFire 8.0
    • getEnableAutoReconnect

      @Nullable public Boolean getEnableAutoReconnect()
      Gets the value for the auto-reconnect setting.
      Returns:
      a boolean value indicating whether auto-reconnect was specified (non-null) and whether it was enabled or not.
    • setGatewayConflictResolver

      public void setGatewayConflictResolver(@Nullable org.apache.geode.cache.util.GatewayConflictResolver gatewayConflictResolver)
      Requires GemFire 7.0 or higher
      Parameters:
      gatewayConflictResolver - defined as Object in the signature for backward compatibility with Gemfire 6 compatibility. This must be an instance of GatewayConflictResolver
    • getGatewayConflictResolver

      @Nullable public org.apache.geode.cache.util.GatewayConflictResolver getGatewayConflictResolver()
      Returns:
      the gatewayConflictResolver
    • setJndiDataSources

      public void setJndiDataSources(List<CacheFactoryBean.JndiDataSource> jndiDataSources)
      Parameters:
      jndiDataSources - the list of configured JndiDataSources to use with this Cache.
    • getJndiDataSources

      public List<CacheFactoryBean.JndiDataSource> getJndiDataSources()
      Returns:
      the list of configured JndiDataSources.
    • setLockLease

      public void setLockLease(@Nullable Integer lockLease)
      Sets the number of seconds for implicit and explicit object lock leases to timeout.
      Parameters:
      lockLease - an integer value indicating the object lock lease timeout.
    • getLockLease

      @Nullable public Integer getLockLease()
      Returns:
      the lockLease
    • setLockTimeout

      public void setLockTimeout(@Nullable Integer lockTimeout)
      Sets the number of seconds in which the implicit object lock request will timeout.
      Parameters:
      lockTimeout - an integer value specifying the object lock request timeout.
    • getLockTimeout

      @Nullable public Integer getLockTimeout()
      Returns:
      the lockTimeout
    • setMessageSyncInterval

      public void setMessageSyncInterval(@Nullable Integer messageSyncInterval)
      Set for client subscription queue synchronization when this member acts as a server to clients and server redundancy is used. Sets the frequency (in seconds) at which the primary server sends messages to its secondary servers to remove queued events that have already been processed by the clients.
      Parameters:
      messageSyncInterval - an integer value specifying the number of seconds in which the primary server sends messages to secondary servers.
    • getMessageSyncInterval

      @Nullable public Integer getMessageSyncInterval()
      Returns:
      the messageSyncInterval
    • setPeerCacheConfigurers

      public void setPeerCacheConfigurers(PeerCacheConfigurer... peerCacheConfigurers)
      Null-safe operation to set an array of PeerCacheConfigurers used to apply additional configuration to this CacheFactoryBean when using Annotation-based configuration.
      Parameters:
      peerCacheConfigurers - array of PeerCacheConfigurers used to apply additional configuration to this CacheFactoryBean.
      See Also:
    • setPeerCacheConfigurers

      public void setPeerCacheConfigurers(List<PeerCacheConfigurer> peerCacheConfigurers)
      Null-safe operation to set an Iterable of PeerCacheConfigurers to apply additional configuration to this CacheFactoryBean when using Annotation-based configuration.
      Parameters:
      peerCacheConfigurers - Iterable of PeerCacheConfigurers used to apply additional configuration to this CacheFactoryBean.
      See Also:
    • setSearchTimeout

      public void setSearchTimeout(@Nullable Integer searchTimeout)
      Set the number of seconds a netSearch operation can wait for data before timing out.
      Parameters:
      searchTimeout - an integer value indicating the netSearch timeout value.
    • getSearchTimeout

      @Nullable public Integer getSearchTimeout()
      Returns:
      the searchTimeout
    • setSecurityManager

      public void setSecurityManager(@Nullable org.apache.geode.security.SecurityManager securityManager)
      Configures the SecurityManager used to secure this cache.
      Parameters:
      securityManager - SecurityManager used to secure this cache.
      See Also:
      • SecurityManager
    • getSecurityManager

      @Nullable public org.apache.geode.security.SecurityManager getSecurityManager()
      Returns the SecurityManager used to secure this cache.
      Returns:
      the SecurityManager used to secure this cache.
      See Also:
      • SecurityManager
    • setUseClusterConfiguration

      public void setUseClusterConfiguration(@Nullable Boolean useSharedConfiguration)
      Sets the state of the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.
      Parameters:
      useSharedConfiguration - boolean value to set the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.
    • getUseClusterConfiguration

      @Nullable public Boolean getUseClusterConfiguration()
      Return the state of the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.
      Returns:
      the current boolean value for the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.
    • setUseUDPMembershipMessenger

      public void setUseUDPMembershipMessenger(@Nullable Boolean useUDPMembershipMessenger)
      Sets the state of the use-udp-membership-messenger VMware GemFire property.
      Parameters:
      useUDPMembershipMessenger - boolean value to set the use-udp-membership-messenger property.
    • getUseUDPMembershipMessenger

      @Nullable public Boolean getUseUDPMembershipMessenger()
      Return the state of the use-udp-membership-messengerproperty.
      Returns:
      the current boolean value for the use-udp-membership-messenger property..