public class AnnotationBasedExpiration<K,V> extends Object implements BeanFactoryAware, com.gemstone.gemfire.cache.CustomExpiry<K,V>
Annotation
,
BeanFactory
,
BeanFactoryAware
,
ExpirationActionType
,
Expiration
,
IdleTimeoutExpiration
,
TimeToLiveExpiration
,
CustomExpiry
,
ExpirationAction
,
ExpirationAttributes
,
Region
Modifier and Type | Class and Description |
---|---|
protected static class |
AnnotationBasedExpiration.ExpirationMetaData
The ExpirationMetaData class encapsulates the settings constituting the expiration policy including
the expiration timeout and the action performed when expiration occurs.
|
Modifier and Type | Field and Description |
---|---|
protected static AtomicReference<BeanFactory> |
BEAN_FACTORY_REFERENCE |
protected static AtomicReference<StandardEvaluationContext> |
EVALUATION_CONTEXT_REFERENCE |
Constructor and Description |
---|
AnnotationBasedExpiration()
Constructs a new instance of the AnnotationBasedExpiration class with no default expiration policy.
|
AnnotationBasedExpiration(com.gemstone.gemfire.cache.ExpirationAttributes defaultExpirationAttributes)
Constructs a new instance of the AnnotationBasedExpiration class initialized with a specific, default
expiration policy.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Called when the Region containing this callback is closed or destroyed, when the Cache is closed,
or when a callback is removed from a Region using an AttributesMutator.
|
static <K,V> AnnotationBasedExpiration<K,V> |
forIdleTimeout()
Constructs an AnnotationBasedExpiration instance with no default ExpirationAttributes to process
Idle Timeout (TTI) Expiration annotated Region Entries.
|
static <K,V> AnnotationBasedExpiration<K,V> |
forIdleTimeout(com.gemstone.gemfire.cache.ExpirationAttributes defaultExpirationAttributes)
Constructs an AnnotationBasedExpiration instance with default ExpirationAttributes to process
Idle Timeout (TTI) Expiration annotated Region Entries.
|
static <K,V> AnnotationBasedExpiration<K,V> |
forTimeToLive()
Constructs an AnnotationBasedExpiration instance with no default ExpirationAttributes to process
Time-To-Live (TTL) Expiration annotated Region Entries.
|
static <K,V> AnnotationBasedExpiration<K,V> |
forTimeToLive(com.gemstone.gemfire.cache.ExpirationAttributes defaultExpirationAttributes)
Constructs an AnnotationBasedExpiration instance with default ExpirationAttributes to process
Time-To-Live (TTL) Expiration annotated Region Entries.
|
protected BeanFactory |
getBeanFactory()
Gets a reference to the BeanFactory in which this AnnotationBasedExpiration Bean belongs.
|
protected com.gemstone.gemfire.cache.ExpirationAttributes |
getDefaultExpirationAttributes()
Gets the expiration policy used by default when no application domain object specific expiration meta-data
has been specified.
|
protected Expiration |
getExpiration(com.gemstone.gemfire.cache.Region.Entry<K,V> entry)
Gets the Expiration Annotation meta-data from the Region Entry.
|
protected AnnotationBasedExpiration.ExpirationMetaData |
getExpirationMetaData(com.gemstone.gemfire.cache.Region.Entry<K,V> entry)
Gets custom expiration (Annotation-based) meta-data for the given Region entry.
|
com.gemstone.gemfire.cache.ExpirationAttributes |
getExpiry(com.gemstone.gemfire.cache.Region.Entry<K,V> entry)
Calculate the expiration for a given entry.
|
protected IdleTimeoutExpiration |
getIdleTimeout(com.gemstone.gemfire.cache.Region.Entry<K,V> entry)
Gets the IdleTimeoutExpiration Annotation meta-data from the Region Entry.
|
protected TimeToLiveExpiration |
getTimeToLive(com.gemstone.gemfire.cache.Region.Entry<K,V> entry)
Gets the TimeToLiveExpiration Annotation meta-data from the Region Entry.
|
protected void |
initEvaluationContext() |
protected boolean |
isExpirationConfigured(com.gemstone.gemfire.cache.Region.Entry<K,V> entry)
Determines whether the Region Entry has been annotated with the Expiration Annotation.
|
protected boolean |
isIdleTimeoutConfigured(com.gemstone.gemfire.cache.Region.Entry<K,V> entry)
Determines whether the Region Entry has been annotated with the IdleTimeoutExpiration Annotation.
|
protected boolean |
isTimeToLiveConfigured(com.gemstone.gemfire.cache.Region.Entry<K,V> entry)
Determines whether the Region Entry has been annotated with the TimeToLiveExpiration Annotation.
|
protected com.gemstone.gemfire.cache.ExpirationAttributes |
newExpirationAttributes(AnnotationBasedExpiration.ExpirationMetaData expirationMetaData)
Constructs a new instance of ExpirationAttributes configured with the application domain object specific
expiration policy.
|
void |
setBeanFactory(BeanFactory beanFactory)
Sets the BeanFactory managing this AnnotationBasedExpiration bean in the Spring context.
|
void |
setDefaultExpirationAttributes(com.gemstone.gemfire.cache.ExpirationAttributes defaultExpirationAttributes)
Sets the expiration policy to use by default when no application domain object specific expiration meta-data
has been specified.
|
protected static final AtomicReference<BeanFactory> BEAN_FACTORY_REFERENCE
protected static final AtomicReference<StandardEvaluationContext> EVALUATION_CONTEXT_REFERENCE
public AnnotationBasedExpiration()
public AnnotationBasedExpiration(com.gemstone.gemfire.cache.ExpirationAttributes defaultExpirationAttributes)
defaultExpirationAttributes
- expiration settings used as the default expiration policy.ExpirationAttributes
public static <K,V> AnnotationBasedExpiration<K,V> forIdleTimeout()
K
- the class type of the Region Entry Key.V
- the class type of the Region Entry Value.AnnotationBasedExpiration
,
IdleTimeoutExpiration
,
forIdleTimeout(com.gemstone.gemfire.cache.ExpirationAttributes)
public static <K,V> AnnotationBasedExpiration<K,V> forIdleTimeout(com.gemstone.gemfire.cache.ExpirationAttributes defaultExpirationAttributes)
K
- the class type of the Region Entry Key.V
- the class type of the Region Entry Value.defaultExpirationAttributes
- ExpirationAttributes used by default if no Expiration policy was specified
on the Region Entry.AnnotationBasedExpiration
,
IdleTimeoutExpiration
public static <K,V> AnnotationBasedExpiration<K,V> forTimeToLive()
K
- the class type of the Region Entry Key.V
- the class type of the Region Entry Value.AnnotationBasedExpiration
,
TimeToLiveExpiration
,
forTimeToLive(com.gemstone.gemfire.cache.ExpirationAttributes)
public static <K,V> AnnotationBasedExpiration<K,V> forTimeToLive(com.gemstone.gemfire.cache.ExpirationAttributes defaultExpirationAttributes)
K
- the class type of the Region Entry Key.V
- the class type of the Region Entry Value.defaultExpirationAttributes
- ExpirationAttributes used by default if no Expiration policy was specified
on the Region Entry.AnnotationBasedExpiration
,
TimeToLiveExpiration
protected void initEvaluationContext()
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory
in interface BeanFactoryAware
beanFactory
- the Spring BeanFactory to which this bean belongs.BeansException
- if the BeanFactory reference cannot be initialized.BeanFactory
,
initEvaluationContext()
protected BeanFactory getBeanFactory()
IllegalStateException
- if the BeanFactory reference was not properly initialized.BeanFactory
public void setDefaultExpirationAttributes(com.gemstone.gemfire.cache.ExpirationAttributes defaultExpirationAttributes)
defaultExpirationAttributes
- expiration settings used as the default expiration policy.getDefaultExpirationAttributes()
,
ExpirationAttributes
protected com.gemstone.gemfire.cache.ExpirationAttributes getDefaultExpirationAttributes()
setDefaultExpirationAttributes(com.gemstone.gemfire.cache.ExpirationAttributes)
,
ExpirationAttributes
public com.gemstone.gemfire.cache.ExpirationAttributes getExpiry(com.gemstone.gemfire.cache.Region.Entry<K,V> entry)
protected AnnotationBasedExpiration.ExpirationMetaData getExpirationMetaData(com.gemstone.gemfire.cache.Region.Entry<K,V> entry)
entry
- the Region entry used as the source of the expiration meta-data.NullPointerException
- if the Region.Entry, Region or the Region's attributes are null.AnnotationBasedExpiration.ExpirationMetaData
protected com.gemstone.gemfire.cache.ExpirationAttributes newExpirationAttributes(AnnotationBasedExpiration.ExpirationMetaData expirationMetaData)
expirationMetaData
- application domain object specific expiration policy meta-data used to construct
the ExpirationAttributes.AnnotationBasedExpiration.ExpirationMetaData
,
ExpirationAttributes
,
getDefaultExpirationAttributes()
protected boolean isExpirationConfigured(com.gemstone.gemfire.cache.Region.Entry<K,V> entry)
entry
- the Region.Entry to evaluate for the presence of the Expiration Annotation.Expiration
,
isAnnotationPresent(Object, Class)
protected Expiration getExpiration(com.gemstone.gemfire.cache.Region.Entry<K,V> entry)
entry
- the Region.Entry from which to extract the Expiration Annotation meta-data.null
if the Region Entry has not been annotated with @Expiration.Expiration
,
getAnnotation(Object, Class)
protected boolean isIdleTimeoutConfigured(com.gemstone.gemfire.cache.Region.Entry<K,V> entry)
entry
- the Region.Entry to evaluate for the presence of the IdleTimeoutExpiration Annotation.IdleTimeoutExpiration
,
isAnnotationPresent(Object, Class)
protected IdleTimeoutExpiration getIdleTimeout(com.gemstone.gemfire.cache.Region.Entry<K,V> entry)
entry
- the Region.Entry from which to extract the IdleTimeoutExpiration Annotation meta-data.null
if the Region Entry has not been annotated with @IdleTimeoutExpiration.IdleTimeoutExpiration
,
getAnnotation(Object, Class)
protected boolean isTimeToLiveConfigured(com.gemstone.gemfire.cache.Region.Entry<K,V> entry)
entry
- the Region.Entry to evaluate for the presence of the TimeToLiveExpiration Annotation.TimeToLiveExpiration
,
isAnnotationPresent(Object, Class)
protected TimeToLiveExpiration getTimeToLive(com.gemstone.gemfire.cache.Region.Entry<K,V> entry)
entry
- the Region.Entry from which to extract the TimeToLiveExpiration Annotation meta-data.null
if the Region Entry has not been annotated with @TimeToLiveExpiration.TimeToLiveExpiration
,
getAnnotation(Object, Class)
public void close()
close
in interface com.gemstone.gemfire.cache.CacheCallback