Initial implementation and tests for JIRA feature requests SGF-207 and SGF-254 supporting inheritable Region templates when defining GemFire Regions using Spring Data GemFire XML configuration meta-data. This feature allows common Region configuration and attribute values to be defined once and then shared across multiple Region bean definitions in the Spring context for added convenience.

This commit is contained in:
John Blum
2014-08-19 11:41:51 -07:00
committed by John Blum
parent 4121581dea
commit 5d27c19ef5
6 changed files with 721 additions and 274 deletions

View File

@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:gfe="http://www.springframework.org/schema/gemfire"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
">
<gfe:cache/>
<gfe:async-event-queue id="TestAsyncEventQueue" persistent="false" parallel="true" dispatcher-threads="4">
<gfe:async-event-listener>
<bean class="org.springframework.data.gemfire.config.TemplateRegionsNamespaceTests$TestAsyncEventListener"/>
</gfe:async-event-listener>
</gfe:async-event-queue>
<gfe:gateway-sender id="TestGatewaySender" remote-distributed-system-id="123" manual-start="true" persistent="false"
parallel="true" dispatcher-threads="8"/>
<!-- Generic Region -->
<gfe:region-template id="BaseRegion" cloning-enabled="true" concurrency-checks-enabled="false"
disk-synchronous="true" ignore-jta="true" initial-capacity="1000"
key-constraint="java.lang.Long" load-factor="0.90" persistent="false" statistics="true"
value-constraint="java.lang.String" index-update-type="synchronous">
<gfe:cache-loader>
<bean class="org.springframework.data.gemfire.config.TemplateRegionsNamespaceTests$TestCacheLoader" p:name="X"/>
</gfe:cache-loader>
<gfe:cache-writer>
<bean class="org.springframework.data.gemfire.config.TemplateRegionsNamespaceTests$TestCacheWriter" p:name="Y"/>
</gfe:cache-writer>
</gfe:region-template>
<gfe:region-template id="ExtendedRegionWithOverrides" cloning-enabled="false" concurrency-checks-enabled="true"
disk-synchronous="false" ignore-jta="false" key-constraint="java.lang.String" template="BaseRegion">
<gfe:cache-listener>
<bean class="org.springframework.data.gemfire.config.TemplateRegionsNamespaceTests$TestCacheListener" p:name="Z"/>
</gfe:cache-listener>
<gfe:gateway-sender-ref bean="TestGatewaySender"/>
<gfe:async-event-queue-ref bean="TestAsyncEventQueue"/>
</gfe:region-template>
<!-- REPLICATE Region -->
<gfe:replicated-region-template id="BaseReplicateRegion" concurrency-level="2" enable-async-conflation="true"
enable-subscription-conflation="true" template="BaseRegion">
<gfe:subscription type="CACHE_CONTENT"/>
<gfe:eviction type="ENTRY_COUNT" threshold="1000" action="OVERFLOW_TO_DISK"/>
</gfe:replicated-region-template>
<gfe:replicated-region id="SimpleReplicateRegion" persistent="true" concurrency-level="8" is-lock-grantor="true" scope="global"
key-constraint="java.lang.Integer">
<gfe:cache-listener>
<bean class="org.springframework.data.gemfire.config.TemplateRegionsNamespaceTests$TestCacheListener" p:name="A"/>
</gfe:cache-listener>
</gfe:replicated-region>
<gfe:replicated-region id="InheritedReplicateRegion" template="BaseReplicateRegion"/>
<gfe:replicated-region id="ComplexReplicateRegion" persistent="true" key-constraint="java.lang.Integer" cloning-enabled="false"
template="BaseReplicateRegion">
<gfe:cache-listener>
<bean class="org.springframework.data.gemfire.config.TemplateRegionsNamespaceTests$TestCacheListener" p:name="AAA"/>
</gfe:cache-listener>
<gfe:cache-loader>
<bean class="org.springframework.data.gemfire.config.TemplateRegionsNamespaceTests$TestCacheLoader" p:name="xyz"/>
</gfe:cache-loader>
<gfe:subscription type="ALL"/>
<gfe:eviction type="ENTRY_COUNT" threshold="1024" action="OVERFLOW_TO_DISK"/>
</gfe:replicated-region>
<!-- PARTITION Region -->
<gfe:partitioned-region-template id="BasePartitionRegion" copies="2" local-max-memory="1000" total-max-memory="4000"
total-buckets="77" recovery-delay="1000" startup-recovery-delay="5000">
<gfe:partition-resolver>
<bean class="org.springframework.data.gemfire.config.TemplateRegionsNamespaceTests$TestPartitionResolver" p:name="A"/>
</gfe:partition-resolver>
<gfe:partition-listener>
<bean class="org.springframework.data.gemfire.config.TemplateRegionsNamespaceTests$TestPartitionListener" p:name="B"/>
</gfe:partition-listener>
<gfe:subscription type="ALL"/>
<gfe:eviction type="MEMORY_SIZE" threshold="4000" action="OVERFLOW_TO_DISK"/>
</gfe:partitioned-region-template>
<gfe:local-region-template id="BaseLocalRegion" concurrency-level="4">
<gfe:eviction type="ENTRY_COUNT" threshold="8192" action="LOCAL_DESTROY"/>
</gfe:local-region-template>
</beans>