Uploaded image for project: 'Spring Data GemFire'
  1. Spring Data GemFire
  2. SGF-747

Properly enable statistics when Annotation-based Expiration Policies are enabled with EnableExpiration

    Details

    • Sprint:
      Lovelace M2 / M3

      Description

      Currently, when a user is configuring Pivotal GemFire client or peer cache Region Expiration Policies using SDG's @EnableExpiration, as explained in the Reference Guide, along with, when a user has defined an application domain model object, or entity, with either an Idle Timeout (TTI) or a Time-To-Live (TTL) Expiration policy, as documented here, the user will unfortunately encounter an IllegalStateException stating that statistics have not been properly enabled for the Region as described in the Pivotal GemFire User Guide.

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'People': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Statistics must be enabled for expiration
      
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1706)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:741)
      	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
      	at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:88)
      	at org.springframework.data.gemfire.config.annotation.EnableExpirationConfigurationIntegrationTests.newApplicationContext(EnableExpirationConfigurationIntegrationTests.java:52)
      	at org.springframework.data.gemfire.config.annotation.EnableExpirationConfigurationIntegrationTests.assertPeerCacheRegionExpirationPoliciesAreCorrect(EnableExpirationConfigurationIntegrationTests.java:85)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
      	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
      	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
      	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
      Caused by: java.lang.IllegalStateException: Statistics must be enabled for expiration
      	at org.apache.geode.cache.AttributesFactory.validateAttributes(AttributesFactory.java:1407)
      	at org.apache.geode.cache.AttributesFactory.create(AttributesFactory.java:1320)
      	at org.apache.geode.cache.RegionFactory.create(RegionFactory.java:755)
      	at org.springframework.data.gemfire.RegionFactoryBean.lambda$newRegion$2(RegionFactoryBean.java:188)
      	at java.util.Optional.orElseGet(Optional.java:267)
      	at org.springframework.data.gemfire.RegionFactoryBean.newRegion(RegionFactoryBean.java:185)
      	at org.springframework.data.gemfire.RegionFactoryBean.createRegion(RegionFactoryBean.java:162)
      	at org.springframework.data.gemfire.RegionLookupFactoryBean.afterPropertiesSet(RegionLookupFactoryBean.java:97)
      	at org.springframework.data.gemfire.LocalRegionFactoryBean.afterPropertiesSet(LocalRegionFactoryBean.java:37)
      	at org.springframework.data.gemfire.config.annotation.support.CacheTypeAwareRegionFactoryBean.newServerRegion(CacheTypeAwareRegionFactoryBean.java:226)
      	at org.springframework.data.gemfire.config.annotation.support.CacheTypeAwareRegionFactoryBean.createRegion(CacheTypeAwareRegionFactoryBean.java:135)
      	at org.springframework.data.gemfire.RegionLookupFactoryBean.afterPropertiesSet(RegionLookupFactoryBean.java:97)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1765)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702)
      	... 35 more
      

        Attachments

          Activity

            People

            • Assignee:
              jblum John Blum
              Reporter:
              jblum John Blum
              Last updater:
              Christoph Strobl
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: