Fixes JIRA issue SGF-259 involving circular dependencies between an Async Event Queue and corresponding, registered Async Event Listener.

This commit is contained in:
John Blum
2014-02-27 22:36:58 -08:00
parent bc7e284fbc
commit 2656a25056
3 changed files with 217 additions and 0 deletions

View File

@@ -15,6 +15,7 @@
*/
package org.springframework.data.gemfire.config;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
@@ -46,6 +47,10 @@ public class AsyncEventQueueParser extends AbstractSingleBeanDefinitionParser {
builder.addPropertyValue("asyncEventListener", asyncEventListener);
if (asyncEventListener instanceof RuntimeBeanReference) {
builder.addDependsOn(((RuntimeBeanReference) asyncEventListener).getBeanName());
}
String cacheRefAttribute = element.getAttribute("cache-ref");
String cacheName = (StringUtils.hasText(cacheRefAttribute) ? cacheRefAttribute
@@ -79,6 +84,7 @@ public class AsyncEventQueueParser extends AbstractSingleBeanDefinitionParser {
int i = 0;
String name = regionName + ".asyncEventQueue#" + i;
while (parserContext.getRegistry().isBeanNameInUse(name)) {
i++;
name = regionName + ".asyncEventQueue#" + i;