Announcement Announcement Module
No announcement yet.
How to create region name like this '"/root/myRegion" using SGF 1.1.1 Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to create region name like this '"/root/myRegion" using SGF 1.1.1

    We have a PROD GF Distributed System running ( and have some region names like these: /root/account, /root/transactions. We are planning to migrate to GF 6.6 and use SGF 1.1.1 but having issues in our POC when creating region names with "/" as indicated above for backward compatibility. Additionally we have existing clients using GF .Net NativeClient 3.5.

    We would like not to change the region names to minimize changing client codes and function service code.

    Anybody have done this already?


  • #2
    The gfe namespace doesn't support this yet but you can do something like this:
    import org.springframework.beans.factory.BeanNameAware;
    import org.springframework.beans.factory.FactoryBean;
    import org.springframework.beans.factory.InitializingBean;
    import com.gemstone.gemfire.cache.Region;
    import com.gemstone.gemfire.cache.RegionAttributes;
    public class SubRegionFactoryBean implements FactoryBean<Region<?,?>>, InitializingBean, BeanNameAware {
    	private String name;
    	private Region<?,?> parent;
    	private Region<?,?> region;
    	private RegionAttributes<?,?> attributes;
    	public Region<?,?> getObject() throws Exception {
    		return this.region;
    	SubRegionFactoryBean(Region<?,?> parent){
    		this.parent = parent;
    	public Class<?> getObjectType() {
    		return Region.class;
    	public boolean isSingleton() {
    		return true;
    	public void setAttributes(RegionAttributes<?,?> attributes) {
    		this.attributes = attributes;
    	public void afterPropertiesSet() throws Exception {
    	    if (this.attributes == null){
    	    	this.attributes = parent.getAttributes();
    		this.region = this.parent.createSubregion(,this.attributes);
    	public void setBeanName(String name) { = name;
    In your spring xml:

       <gfe:replicated-region id="root/>
       <bean id="accounts" class="">
            <constructor-arg ref="root"/>
        <bean id="transactions" class="">
            <constructor-arg ref="root"/>


    • #3
      Thanks for the response.

      What I really would like to do is to be able to create a region name with "/" in my spring.xml:
          <gfe:cache cache-xml-location="cache-server.xml"
              properties-ref="props" />
          <util:properties id="props" location="" />
          <gfe:replicated-region id="transRegion"
              cache-ref="gemfire-cache" persistent="true">
              <gfe:disk-store max-oplog-size="2048"
                  synchronous-write="false" time-interval="60000">
                  <gfe:disk-dir location="/data/transaction" />


      • #4
        I understand. That would essentially be a convenient way to do the same thing internally. Gemfire doesnt support region
        names with '/' in them. It's really a syntax to reference subRegions in Gemfire OQL and should work with the configuration I proposed.

        We will be adding namespace support for subregions in the next release but the complete solution is a bit more involved since sub regions may have their own attributes, etc. So we will require nested region elements in addition to supporting path expressions.

        Watch if you want to be notified of the status
        Last edited by dturanski; May 31st, 2012, 07:37 AM.