public abstract class AbstractBasicCacheFactoryBean extends AbstractFactoryBeanSupport<org.apache.geode.cache.GemFireCache> implements org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.dao.support.PersistenceExceptionTranslator, org.springframework.context.Phased
CacheFactoryBean
and ClientCacheFactoryBean
classes,
used to create Apache Geode peer Cache
and ClientCache
instances, respectively.
This class implements Spring's PersistenceExceptionTranslator
interface and is auto-detected by Spring's
PersistenceExceptionTranslationPostProcessor
to enable AOP-based translation of native Apache Geode
RuntimeExceptions
to Spring's DataAccessException
hierarchy. Therefore,
the presence of this class automatically enables Spring's PersistenceExceptionTranslationPostProcessor
to translate native Apache Geode thrown GemFireException
and GemFireCheckedException
types
as Spring DataAccessExceptions
.
In addition, this class also assumes the responsibility of positioning the creation of the cache in the appropriate
phase of the Spring container's lifecycle, providing default callbacks for both initialization and destruction.
More importantly, this abstract class encapsulates configuration applicable to tuning Apache Geode in order to
efficiently use JVM Heap memory. Since Apache Geode stores data in-memory, on the JVM Heap, it is important that
Apache Geode be tuned to monitor the JVM Heap and respond to memory pressure accordingly, by evicting data
and issuing warnings when the JVM Heap reaches critical mass.
This abstract class is also concerned with the configuration of PDX and transaction event handling along with
whether the contents (entries) of the cache should be made effectively immutable on reads (i.e. get(key)).
In summary, this abstract class primarily handles and encapsulates the configuration of the following concerns:
ClientCache
and peer Cache
instances.GemFireCheckedException
,
GemFireException
,
Cache
,
CacheFactory
,
DiskStore
,
GemFireCache
,
Region
,
TransactionListener
,
TransactionWriter
,
ClientCache
,
ClientCacheFactory
,
PdxSerializer
,
DisposableBean
,
FactoryBean
,
InitializingBean
,
Phased
,
DataAccessException
,
PersistenceExceptionTranslationPostProcessor
,
PersistenceExceptionTranslator
,
CacheFactoryBean
,
ClientCacheFactoryBean
,
ClientCacheConfigurer
,
PeerCacheConfigurer
,
AbstractFactoryBeanSupport
Modifier and Type | Class and Description |
---|---|
static interface |
AbstractBasicCacheFactoryBean.CacheFactoryInitializer<T>
Callback interface for initializing a
CacheFactory or a ClientCacheFactory instance,
which is used to create an instance of GemFireCache . |
static interface |
AbstractBasicCacheFactoryBean.PdxConfigurer<T>
Callback interface to configure PDX.
|
DEFAULT_SINGLETON
Constructor and Description |
---|
AbstractBasicCacheFactoryBean() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Initializes this cache
FactoryBean after all properties for this cache bean have been set
by the Spring container. |
protected abstract void |
applyCacheConfigurers()
Applies any user-defined cache configurers (e.g.
|
protected void |
close(org.apache.geode.cache.GemFireCache cache)
Null-safe method used to close the
GemFireCache by calling RegionService.close()
iff the cache is not already closed. |
protected org.apache.geode.cache.GemFireCache |
configureHeapPercentages(org.apache.geode.cache.GemFireCache cache)
Configures the
GemFireCache critical and eviction heap thresholds as percentages. |
protected org.apache.geode.cache.GemFireCache |
configureOffHeapPercentages(org.apache.geode.cache.GemFireCache cache)
Configures the
GemFireCache critical and eviction off-heap thresholds as percentages. |
protected <T> T |
configurePdx(AbstractBasicCacheFactoryBean.PdxConfigurer<T> pdxConfigurer)
Configures the cache to use PDX serialization.
|
void |
destroy()
Destroys the cache bean on Spring container shutdown.
|
protected abstract <T extends org.apache.geode.cache.GemFireCache> |
doFetchCache()
|
protected abstract org.apache.geode.cache.GemFireCache |
doGetObject()
|
protected java.lang.Class<? extends org.apache.geode.cache.GemFireCache> |
doGetObjectType()
By default, returns
GemFireCache Class . |
protected <T extends org.apache.geode.cache.GemFireCache> |
fetchCache()
Fetches an existing cache instance from the Apache Geode cache factory.
|
<T extends org.apache.geode.cache.GemFireCache> |
getCache()
Returns a reference to the constructed, configured an initialized
GemFireCache instance created by
this cache FactoryBean . |
AbstractBasicCacheFactoryBean.CacheFactoryInitializer |
getCacheFactoryInitializer()
Return the
AbstractBasicCacheFactoryBean.CacheFactoryInitializer called by this FactoryBean to initialize the Apache Geode
cache factory used to create the cache constructed by this FactoryBean . |
java.lang.Boolean |
getCopyOnRead()
Returns the configuration of the
GemFireCache.getCopyOnRead() property set on the GemFireCache . |
java.lang.Float |
getCriticalHeapPercentage()
Gets the configuration of the
GemFireCache critical heap percentage property. |
java.lang.Float |
getCriticalOffHeapPercentage()
Gets the configuration of the
GemFireCache critical off-heap percentage property. |
java.lang.Float |
getEvictionHeapPercentage()
Gets the configuration of the
GemFireCache eviction heap percentage property. |
java.lang.Float |
getEvictionOffHeapPercentage()
Gets the configuration of the
GemFireCache eviction off-heap percentage property. |
org.apache.geode.cache.GemFireCache |
getObject()
Returns the
cache object reference created by this cache FactoryBean . |
java.lang.Class<? extends org.apache.geode.cache.GemFireCache> |
getObjectType()
Returns the
type of GemFireCache created by this cache FactoryBean . |
<T extends org.apache.geode.cache.GemFireCache> |
getOptionalCache()
Returns an
Optional reference to the constructed, configured and initialized GemFireCache
instance created by this cache FactoryBean . |
java.lang.String |
getPdxDiskStoreName()
Gets the
name of the Apache Geode DiskStore used to store PDX metadata. |
java.lang.Boolean |
getPdxIgnoreUnreadFields()
Gets the configuration determining whether PDX will ignore unread fields when deserializing PDX bytes
back to an
Object . |
java.lang.Boolean |
getPdxPersistent()
Gets the configuration determining whether
type metadata for objects serialized
to PDX will be persisted to disk. |
java.lang.Boolean |
getPdxReadSerialized()
Gets the configuration determining whether
objects stored in the Apache Geode
cache as PDX will be read back as PDX bytes or (deserialized) as an Object
when Region.get(Object) is called. |
org.apache.geode.pdx.PdxSerializer |
getPdxSerializer()
Get a reference to the configured
PdxSerializer used by this cache to de/serialize objects
stored in the cache and distributed/transferred across the distributed system as PDX bytes. |
int |
getPhase()
Returns the configured lifecycle phase for this cache bean in the Spring container.
|
java.util.List<org.apache.geode.cache.TransactionListener> |
getTransactionListeners()
Returns the
List of configured, application-defined TransactionListeners
registered with the cache (transaction manager) to enable applications to receive transaction events after a
transaction is processed (i.e. |
org.apache.geode.cache.TransactionWriter |
getTransactionWriter()
Return the configured
TransactionWriter used to process and handle transaction events. |
protected java.lang.Object |
initializeFactory(java.lang.Object factory)
Initializes the given
CacheFactory or ClientCacheFactory
with the configured AbstractBasicCacheFactoryBean.CacheFactoryInitializer . |
boolean |
isClose()
Returns a boolean value used to determine whether the cache will be closed on shutdown of the Spring container.
|
boolean |
isCopyOnRead()
Determines whether
objects stored in the GemFireCache are copied when read
(i.e. |
protected boolean |
isNotClosed(org.apache.geode.cache.GemFireCache cache)
Determines if the
GemFireCache has not been closed yet. |
protected org.apache.geode.cache.GemFireCache |
registerTransactionListeners(org.apache.geode.cache.GemFireCache cache)
Registers configured, application-defined
TransactionListeners with the cache
(transaction manager) to listen for and receive transaction events when a (cache) transaction is processed
(e.g. |
protected org.apache.geode.cache.GemFireCache |
registerTransactionWriter(org.apache.geode.cache.GemFireCache cache)
Registers the configured, application-defined
TransactionWriter with the cache (transaction manager)
to receive transaction events with the intent to alter the transaction outcome (e.g. |
protected void |
setCache(org.apache.geode.cache.GemFireCache cache)
Sets a reference to the constructed, configured an initialized
GemFireCache instance created by
this cache FactoryBean . |
void |
setCacheFactoryInitializer(AbstractBasicCacheFactoryBean.CacheFactoryInitializer cacheFactoryInitializer)
Set the
AbstractBasicCacheFactoryBean.CacheFactoryInitializer called by this FactoryBean to initialize the Apache Geode
cache factory used to create the cache constructed by this FactoryBean . |
void |
setClose(boolean close)
Sets a boolean value used to determine whether the cache should be closed on shutdown of the Spring container.
|
void |
setCopyOnRead(java.lang.Boolean copyOnRead)
Sets the
GemFireCache.getCopyOnRead() property of the GemFireCache . |
void |
setCriticalHeapPercentage(java.lang.Float criticalHeapPercentage)
Set the
GemFireCache critical heap percentage property. |
void |
setCriticalOffHeapPercentage(java.lang.Float criticalOffHeapPercentage)
Set the
GemFireCache critical off-heap percentage property. |
void |
setEvictionHeapPercentage(java.lang.Float evictionHeapPercentage)
Set the
GemFireCache eviction heap percentage property. |
void |
setEvictionOffHeapPercentage(java.lang.Float evictionOffHeapPercentage)
Set the
GemFireCache eviction off-heap percentage property. |
void |
setPdxDiskStoreName(java.lang.String pdxDiskStoreName)
Sets the
name of the Apache Geode DiskStore used to store PDX metadata. |
void |
setPdxIgnoreUnreadFields(java.lang.Boolean pdxIgnoreUnreadFields)
Configures whether PDX will ignore unread fields when deserializing PDX bytes back to an
Object . |
void |
setPdxPersistent(java.lang.Boolean pdxPersistent)
Configures whether
type metadata for objects serialized to PDX
will be persisted to disk. |
void |
setPdxReadSerialized(java.lang.Boolean pdxReadSerialized)
Configures whether
objects stored in the Apache Geode cache as PDX
will be read back as PDX bytes or (deserialized) as an Object when Region.get(Object)
is called. |
void |
setPdxSerializer(org.apache.geode.pdx.PdxSerializer serializer)
Configures a reference to
PdxSerializer used by this cache to de/serialize objects
stored in the cache and distributed/transferred across the distributed system as PDX bytes. |
protected void |
setPhase(int phase)
Set the lifecycle phase for this cache bean in the Spring container.
|
void |
setTransactionListeners(java.util.List<org.apache.geode.cache.TransactionListener> transactionListeners)
Configures the cache (transaction manager) with a
List of TransactionListeners
implemented by applications to listen for and receive transaction events after a transaction is processed
(i.e. |
void |
setTransactionWriter(org.apache.geode.cache.TransactionWriter transactionWriter)
Configures a
TransactionWriter implemented by the application to receive transaction events and perform
a action, like a veto. |
org.springframework.dao.DataAccessException |
translateExceptionIfPossible(java.lang.RuntimeException exception)
Translates the thrown Apache Geode
RuntimeException into a corresponding Exception from Spring's
generic DataAccessException hierarchy if possible. |
getBeanClassLoader, getBeanFactory, getBeanName, getLogger, getOptionalLogger, isDebugLoggingEnabled, isErrorLoggingEnabled, isInfoLoggingEnabled, isSingleton, isWarnLoggingEnabled, logDebug, logDebug, logError, logError, logInfo, logInfo, logWarning, logWarning, newLogger, setBeanClassLoader, setBeanFactory, setBeanName
protected void setCache(@Nullable org.apache.geode.cache.GemFireCache cache)
GemFireCache
instance created by
this cache FactoryBean
.cache
- GemFireCache
created by this cache FactoryBean
.GemFireCache
@Nullable public <T extends org.apache.geode.cache.GemFireCache> T getCache()
GemFireCache
instance created by
this cache FactoryBean
.T
- parameterized Class
type extending GemFireCache
.GemFireCache
created by this cache FactoryBean
.GemFireCache
public <T extends org.apache.geode.cache.GemFireCache> java.util.Optional<T> getOptionalCache()
Optional
reference to the constructed, configured and initialized GemFireCache
instance created by this cache FactoryBean
.T
- parameterized Class
type extending GemFireCache
.Optional
reference to the GemFireCache
created by this {cache @link FactoryBean}.GemFireCache
,
Optional
,
getCache()
public void setCacheFactoryInitializer(@Nullable AbstractBasicCacheFactoryBean.CacheFactoryInitializer cacheFactoryInitializer)
AbstractBasicCacheFactoryBean.CacheFactoryInitializer
called by this FactoryBean
to initialize the Apache Geode
cache factory used to create the cache constructed by this FactoryBean
.cacheFactoryInitializer
- AbstractBasicCacheFactoryBean.CacheFactoryInitializer
called to initialize the cache factory.org.springframework.data.gemfire.CacheFactoryBean.CacheFactoryInitializer
@Nullable public AbstractBasicCacheFactoryBean.CacheFactoryInitializer getCacheFactoryInitializer()
AbstractBasicCacheFactoryBean.CacheFactoryInitializer
called by this FactoryBean
to initialize the Apache Geode
cache factory used to create the cache constructed by this FactoryBean
.AbstractBasicCacheFactoryBean.CacheFactoryInitializer
called to initialize the cache factory.org.springframework.data.gemfire.CacheFactoryBean.CacheFactoryInitializer
public void setClose(boolean close)
close
- boolean value used to determine whether the cache will be closed on shutdown of the Spring container.public boolean isClose()
public void setCopyOnRead(@Nullable java.lang.Boolean copyOnRead)
GemFireCache.getCopyOnRead()
property of the GemFireCache
.copyOnRead
- a Boolean
value to indicate whether objects
stored in the GemFireCache
are copied on read (i.e. Region.get(Object)
.@Nullable public java.lang.Boolean getCopyOnRead()
GemFireCache.getCopyOnRead()
property set on the GemFireCache
.Boolean
value to indicate whether objects
stored in the GemFireCache
are copied on read (i.e. Region.get(Object)
.public boolean isCopyOnRead()
objects
stored in the GemFireCache
are copied when read
(i.e. Region.get(Object)
.
Defaults to false.objects
stored in the GemFireCache
are copied when read (i.e. Region.get(Object)
.getCopyOnRead()
public void setCriticalHeapPercentage(@Nullable java.lang.Float criticalHeapPercentage)
GemFireCache
critical heap percentage property.criticalHeapPercentage
- Float
value specifying the configuration for the GemFireCache
critical heap percentage.public java.lang.Float getCriticalHeapPercentage()
GemFireCache
critical heap percentage property.Float
value specifying the configuration for the GemFireCache
critical heap percentage.public void setCriticalOffHeapPercentage(@Nullable java.lang.Float criticalOffHeapPercentage)
GemFireCache
critical off-heap percentage property.criticalOffHeapPercentage
- Float
value specifying the configuration for the GemFireCache
critical off-heap percentage.public java.lang.Float getCriticalOffHeapPercentage()
GemFireCache
critical off-heap percentage property.Float
value specifying the configuration for the GemFireCache
critical off-heap
percentage.public void setEvictionHeapPercentage(java.lang.Float evictionHeapPercentage)
GemFireCache
eviction heap percentage property.evictionHeapPercentage
- Float
value specifying the configuration for the GemFireCache
eviction heap percentage.public java.lang.Float getEvictionHeapPercentage()
GemFireCache
eviction heap percentage property.Float
value specifying the configuration for the GemFireCache
eviction heap percentage.public void setEvictionOffHeapPercentage(java.lang.Float evictionOffHeapPercentage)
GemFireCache
eviction off-heap percentage property.evictionOffHeapPercentage
- Float
value specifying the configuration for the GemFireCache
eviction off-heap percentage.public java.lang.Float getEvictionOffHeapPercentage()
GemFireCache
eviction off-heap percentage property.Float
value specifying the configuration for the GemFireCache
eviction off-heap
percentage.public org.apache.geode.cache.GemFireCache getObject() throws java.lang.Exception
cache object reference
created by this cache FactoryBean
.getObject
in interface org.springframework.beans.factory.FactoryBean<org.apache.geode.cache.GemFireCache>
cache object reference
created by this cache FactoryBean
.java.lang.Exception
FactoryBean.getObject()
,
GemFireCache
,
doGetObject()
,
getCache()
protected abstract org.apache.geode.cache.GemFireCache doGetObject()
GemFireCache
instance.GemFireCache
,
getObject()
public java.lang.Class<? extends org.apache.geode.cache.GemFireCache> getObjectType()
type
of GemFireCache
created by this cache FactoryBean
.getObjectType
in interface org.springframework.beans.factory.FactoryBean<org.apache.geode.cache.GemFireCache>
type
of GemFireCache
created by this cache FactoryBean
.FactoryBean.getObjectType()
,
doGetObjectType()
protected java.lang.Class<? extends org.apache.geode.cache.GemFireCache> doGetObjectType()
GemFireCache
Class
.GemFireCache
Class
by default.GemFireCache
,
getObjectType()
,
Class
public void setPdxDiskStoreName(@Nullable java.lang.String pdxDiskStoreName)
name
of the Apache Geode DiskStore
used to store PDX metadata.pdxDiskStoreName
- name
for the PDX DiskStore
.CacheFactory.setPdxDiskStore(String)
,
DiskStore.getName()
@Nullable public java.lang.String getPdxDiskStoreName()
name
of the Apache Geode DiskStore
used to store PDX metadata.name
of the PDX DiskStore
.GemFireCache.getPdxDiskStore()
,
DiskStore.getName()
public void setPdxIgnoreUnreadFields(@Nullable java.lang.Boolean pdxIgnoreUnreadFields)
Object
.
Defaults to false.pdxIgnoreUnreadFields
- Boolean
value controlling ignoring unread fields.CacheFactory.setPdxIgnoreUnreadFields(boolean)
@Nullable public java.lang.Boolean getPdxIgnoreUnreadFields()
Object
.
Defaults to false.Boolean
value controlling ignoring unread fields.GemFireCache.getPdxIgnoreUnreadFields()
public void setPdxPersistent(@Nullable java.lang.Boolean pdxPersistent)
type
metadata for objects
serialized to PDX
will be persisted to disk.pdxPersistent
- Boolean
value controlling whether PDX type
metadata
will be persisted to disk.CacheFactory.setPdxPersistent(boolean)
@Nullable public java.lang.Boolean getPdxPersistent()
type
metadata for objects
serialized
to PDX will be persisted to disk.Boolean
value controlling whether PDX type
metadata will be persisted to disk.GemFireCache.getPdxPersistent()
public void setPdxReadSerialized(@Nullable java.lang.Boolean pdxReadSerialized)
objects
stored in the Apache Geode cache
as PDX
will be read back as PDX bytes or (deserialized) as an Object
when Region.get(Object)
is called.pdxReadSerialized
- Boolean
value controlling the PDX read serialized function.CacheFactory.setPdxReadSerialized(boolean)
@Nullable public java.lang.Boolean getPdxReadSerialized()
objects
stored in the Apache Geode
cache
as PDX will be read back as PDX bytes or (deserialized) as an Object
when Region.get(Object)
is called.Boolean
value controlling the PDX read serialized function.GemFireCache.getPdxReadSerialized()
public void setPdxSerializer(@Nullable org.apache.geode.pdx.PdxSerializer serializer)
PdxSerializer
used by this cache to de/serialize objects
stored in the cache and distributed/transferred across the distributed system as PDX bytes.serializer
- PdxSerializer
used by this cache to de/serialize objects
as PDX.CacheFactory.setPdxSerializer(PdxSerializer)
,
PdxSerializer
@Nullable public org.apache.geode.pdx.PdxSerializer getPdxSerializer()
PdxSerializer
used by this cache to de/serialize objects
stored in the cache and distributed/transferred across the distributed system as PDX bytes.PdxSerializer
.GemFireCache.getPdxSerializer()
,
PdxSerializer
protected void setPhase(int phase)
phase
- Integer.TYPE
value specifying the lifecycle phase for this cache bean
in the Spring container.Phased.getPhase()
public int getPhase()
getPhase
in interface org.springframework.context.Phased
Integer.TYPE
used specifying the lifecycle phase for this cache bean in the Spring container.Phased.getPhase()
public void setTransactionListeners(java.util.List<org.apache.geode.cache.TransactionListener> transactionListeners)
List
of TransactionListeners
implemented by applications to listen for and receive transaction events after a transaction is processed
(i.e. committed or rolled back).transactionListeners
- List
of application-defined TransactionListeners
registered with the cache to listen for and receive transaction events.TransactionListener
public java.util.List<org.apache.geode.cache.TransactionListener> getTransactionListeners()
List
of configured, application-defined TransactionListeners
registered with the cache (transaction manager) to enable applications to receive transaction events after a
transaction is processed (i.e. committed or rolled back).List
of application-defined TransactionListeners
registered with
the cache (transaction manager) to listen for and receive transaction events.TransactionListener
public void setTransactionWriter(@Nullable org.apache.geode.cache.TransactionWriter transactionWriter)
TransactionWriter
implemented by the application to receive transaction events and perform
a action, like a veto.transactionWriter
- TransactionWriter
receiving transaction events.TransactionWriter
@Nullable public org.apache.geode.cache.TransactionWriter getTransactionWriter()
TransactionWriter
used to process and handle transaction events.TransactionWriter
.TransactionWriter
public void afterPropertiesSet() throws java.lang.Exception
FactoryBean
after all properties for this cache bean have been set
by the Spring container.afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
- if initialization fails.InitializingBean.afterPropertiesSet()
,
applyCacheConfigurers()
protected abstract void applyCacheConfigurers()
ClientCacheConfigurer
or PeerCacheConfigurer
)
to this cache FactoryBean
before cache construction, configuration and initialization.protected void close(@Nullable org.apache.geode.cache.GemFireCache cache)
GemFireCache
by calling RegionService.close()
iff the cache is not already closed.cache
- GemFireCache
to close.RegionService.isClosed()
,
RegionService.close()
,
isNotClosed(GemFireCache)
protected boolean isNotClosed(@Nullable org.apache.geode.cache.GemFireCache cache)
GemFireCache
has not been closed yet.cache
- GemFireCache
to evaluate.GemFireCache
is not yet closed.GemFireCache
public void destroy()
destroy
in interface org.springframework.beans.factory.DisposableBean
DisposableBean.destroy()
,
close(GemFireCache)
,
fetchCache()
,
isClose()
@NonNull protected org.apache.geode.cache.GemFireCache configureHeapPercentages(@NonNull org.apache.geode.cache.GemFireCache cache)
GemFireCache
critical and eviction heap thresholds as percentages.cache
- GemFireCache
to configure the critical and eviction heap thresholds;
must not be null.GemFireCache
.java.lang.IllegalArgumentException
- if the critical or eviction heap thresholds are not valid percentages.ResourceManager.setCriticalHeapPercentage(float)
,
ResourceManager.setEvictionHeapPercentage(float)
,
ResourceManager
,
GemFireCache.getResourceManager()
,
GemFireCache
@NonNull protected org.apache.geode.cache.GemFireCache configureOffHeapPercentages(@NonNull org.apache.geode.cache.GemFireCache cache)
GemFireCache
critical and eviction off-heap thresholds as percentages.cache
- GemFireCache
to configure the critical and eviction off-heap thresholds;
must not be null.GemFireCache
.java.lang.IllegalArgumentException
- if the critical or eviction off-heap thresholds are not valid percentages.ResourceManager.setCriticalOffHeapPercentage(float)
,
ResourceManager.setEvictionOffHeapPercentage(float)
,
ResourceManager
,
GemFireCache.getResourceManager()
,
GemFireCache
protected <T> T configurePdx(AbstractBasicCacheFactoryBean.PdxConfigurer<T> pdxConfigurer)
pdxConfigurer
- AbstractBasicCacheFactoryBean.PdxConfigurer
used to configure the cache with PDX serialization.AbstractBasicCacheFactoryBean.PdxConfigurer.getTarget()
.protected <T extends org.apache.geode.cache.GemFireCache> T fetchCache()
T
- parameterized Class
type extending GemFireCache
.org.apache.geode.cache.CacheClosedException
- if an existing cache instance does not exist.ClientCacheFactory.getAnyInstance()
,
CacheFactory.getAnyInstance()
,
GemFireCache
,
doFetchCache()
,
getCache()
protected abstract <T extends org.apache.geode.cache.GemFireCache> T doFetchCache()
fetchCache()
if the GemFireCache
reference returned by 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.T
- parameterized Class
type extending GemFireCache
.GemFireCache
instance.org.apache.geode.cache.CacheClosedException
- if a GemFireCache
reference does not exist.fetchCache()
@Nullable protected java.lang.Object initializeFactory(java.lang.Object factory)
CacheFactory
or ClientCacheFactory
with the configured AbstractBasicCacheFactoryBean.CacheFactoryInitializer
.factory
- CacheFactory
or ClientCacheFactory
to initialize.CacheFactory
or ClientCacheFactory
.org.springframework.data.gemfire.CacheFactoryBean.CacheFactoryInitializer#initialize(Object)
,
ClientCacheFactory
,
CacheFactory
,
getCacheFactoryInitializer()
@NonNull protected org.apache.geode.cache.GemFireCache registerTransactionListeners(@NonNull org.apache.geode.cache.GemFireCache cache)
TransactionListeners
with the cache
(transaction manager) to listen for and receive transaction events when a (cache) transaction is processed
(e.g. committed or rolled back).cache
- GemFireCache
used to register the configured, application-defined
TransactionListeners
; must not be null.GemFireCache
.GemFireCache.getCacheTransactionManager()
,
CacheTransactionManager.addListener(TransactionListener)
,
CacheTransactionManager
,
TransactionListener
,
GemFireCache
@NonNull protected org.apache.geode.cache.GemFireCache registerTransactionWriter(@NonNull org.apache.geode.cache.GemFireCache cache)
TransactionWriter
with the cache (transaction manager)
to receive transaction events with the intent to alter the transaction outcome (e.g. veto).cache
- GemFireCache
used to register the configured, application-defined TransactionWriter
,
must not be null.GemFireCache
.GemFireCache.getCacheTransactionManager()
,
CacheTransactionManager.setWriter(TransactionWriter)
,
CacheTransactionManager
,
TransactionWriter
,
GemFireCache
@Nullable public org.springframework.dao.DataAccessException translateExceptionIfPossible(@Nullable java.lang.RuntimeException exception)
RuntimeException
into a corresponding Exception
from Spring's
generic DataAccessException
hierarchy if possible.translateExceptionIfPossible
in interface org.springframework.dao.support.PersistenceExceptionTranslator
exception
- the Apache Geode RuntimeException
to translate.DataAccessException
or null
if the Apache Geode RuntimeException
could not be translated.PersistenceExceptionTranslator.translateExceptionIfPossible(RuntimeException)
,
DataAccessException