SGF-148 - Added 'close' property on CacheFactoryBean which, if false, will leave cache open when ApplicationContext closes
This commit is contained in:
@@ -201,6 +201,8 @@ public class CacheFactoryBean implements BeanNameAware, BeanFactoryAware, BeanCl
|
||||
protected String beanName;
|
||||
|
||||
protected boolean useBeanFactoryLocator = true;
|
||||
|
||||
protected boolean close = true;
|
||||
|
||||
// PDX options
|
||||
protected Object pdxSerializer;
|
||||
@@ -405,6 +407,9 @@ public class CacheFactoryBean implements BeanNameAware, BeanFactoryAware, BeanCl
|
||||
|
||||
@Override
|
||||
public void destroy() throws Exception {
|
||||
if (!close) {
|
||||
return;
|
||||
}
|
||||
if (cache != null && !cache.isClosed()) {
|
||||
cache.close();
|
||||
}
|
||||
@@ -614,6 +619,14 @@ public class CacheFactoryBean implements BeanNameAware, BeanFactoryAware, BeanCl
|
||||
public void setCriticalHeapPercentage(Float criticalHeapPercentage) {
|
||||
this.criticalHeapPercentage = criticalHeapPercentage;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param close set to false if destroy() should not close the cache
|
||||
*/
|
||||
public void setClose(boolean close) {
|
||||
this.close = close;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -67,6 +67,7 @@ class CacheParser extends AbstractSimpleBeanDefinitionParser {
|
||||
ParsingUtils.setPropertyValue(element, builder, "search-timeout");
|
||||
ParsingUtils.setPropertyValue(element, builder, "critical-heap-percentage");
|
||||
ParsingUtils.setPropertyValue(element, builder, "eviction-heap-percentage");
|
||||
ParsingUtils.setPropertyValue(element, builder, "close");
|
||||
|
||||
List<Element> txListeners = DomUtils.getChildElementsByTagName(element, "transaction-listener");
|
||||
if (!CollectionUtils.isEmpty(txListeners)) {
|
||||
|
||||
Reference in New Issue
Block a user