Class InfinispanDefaultCacheFactoryBean<K,V>

java.lang.Object
org.infinispan.spring.embedded.InfinispanDefaultCacheFactoryBean<K,V>
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean<Cache<K,V>>, org.springframework.beans.factory.InitializingBean

public class InfinispanDefaultCacheFactoryBean<K,V> extends Object implements org.springframework.beans.factory.FactoryBean<Cache<K,V>>, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean

A FactoryBean for creating a native default Infinispan org.infinispan.Cache , delegating to a configurable org.infinispan.manager.CacheContainer. A default Cache is a Cache that uses its CacheContainer's default settings. This is contrary to a named Cache where select settings from a CacheContainer's default configuration may be overridden with settings specific to that Cache.

In addition to creating a Cache this FactoryBean does also control that Cache's lifecycle by shutting it down when the enclosing Spring application context is closed. It is therefore advisable to always use this FactoryBean when creating a Cache.

Author:
Olaf Bergner
  • Field Details

    • logger

      protected static final org.infinispan.commons.logging.Log logger
  • Constructor Details

    • InfinispanDefaultCacheFactoryBean

      public InfinispanDefaultCacheFactoryBean()
  • Method Details

    • setInfinispanCacheContainer

      public void setInfinispanCacheContainer(CacheContainer infinispanCacheContainer)

      Sets the org.infinispan.manager.CacheContainer to be used for creating our Cache instance. Note that this is a mandatory property.

      Parameters:
      infinispanCacheContainer - The org.infinispan.manager.CacheContainer to be used for creating our Cache instance
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
      See Also:
      • InitializingBean.afterPropertiesSet()
    • getObject

      public Cache<K,V> getObject() throws Exception
      Specified by:
      getObject in interface org.springframework.beans.factory.FactoryBean<K>
      Throws:
      Exception
      See Also:
      • FactoryBean.getObject()
    • getObjectType

      public Class<? extends Cache> getObjectType()
      Specified by:
      getObjectType in interface org.springframework.beans.factory.FactoryBean<K>
      See Also:
      • FactoryBean.getObjectType()
    • isSingleton

      public boolean isSingleton()
      Always returns true.
      Specified by:
      isSingleton in interface org.springframework.beans.factory.FactoryBean<K>
      Returns:
      Always true
      See Also:
      • FactoryBean.isSingleton()
    • destroy

      public void destroy() throws Exception
      Shuts down the org.infinispan.Cache created by this FactoryBean.
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
      Throws:
      Exception
      See Also: