polishing
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -22,4 +22,4 @@ si.java.hsp
|
||||
spring-integration-jms/activemq-data/
|
||||
spring-integration-samples/loanshark/application.log*
|
||||
target
|
||||
vf.gf.dmn-*.cfg
|
||||
vf.gf.dmn-*
|
||||
@@ -92,16 +92,10 @@
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-test</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.data.gemfire</groupId>
|
||||
<artifactId>spring-gemfire</artifactId>
|
||||
<version>1.1.0.M2</version>
|
||||
<version>1.1.0.M3</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@@ -118,6 +112,18 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-test</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-core</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
@@ -144,9 +150,9 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-core</artifactId>
|
||||
<artifactId>spring-integration-stream</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
@@ -160,12 +166,6 @@
|
||||
<version>2.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-stream</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.data.gemfire.RegionAttributesFactoryBean;
|
||||
import org.springframework.data.gemfire.RegionFactoryBean;
|
||||
import org.springframework.integration.store.AbstractKeyValueMessageStore;
|
||||
import org.springframework.integration.store.MessageGroupStore;
|
||||
@@ -30,7 +31,6 @@ import org.springframework.util.PatternMatchUtils;
|
||||
|
||||
import com.gemstone.gemfire.cache.Cache;
|
||||
import com.gemstone.gemfire.cache.Region;
|
||||
import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
|
||||
|
||||
/**
|
||||
* Gemfire implementation of the key/value style {@link MessageStore} and {@link MessageGroupStore}
|
||||
@@ -39,23 +39,43 @@ import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.1
|
||||
*/
|
||||
public class GemfireMessageStore extends AbstractKeyValueMessageStore implements InitializingBean{
|
||||
public class GemfireMessageStore extends AbstractKeyValueMessageStore implements InitializingBean {
|
||||
|
||||
private volatile Region<Object, Object> messageStoreRegion;
|
||||
|
||||
|
||||
private final Cache cache;
|
||||
|
||||
|
||||
private volatile boolean ignoreJta = true;
|
||||
|
||||
|
||||
public GemfireMessageStore(Cache cache) {
|
||||
Assert.notNull(cache, "'cache' must not be null");
|
||||
this.cache = cache;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setIgnoreJta(boolean ignoreJta) {
|
||||
this.ignoreJta = ignoreJta;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void afterPropertiesSet() {
|
||||
try {
|
||||
RegionAttributesFactoryBean attributesFactoryBean = new RegionAttributesFactoryBean();
|
||||
attributesFactoryBean.setIgnoreJTA(this.ignoreJta);
|
||||
attributesFactoryBean.afterPropertiesSet();
|
||||
RegionFactoryBean<Object, Object> messageRegionFactoryBean = new RegionFactoryBean<Object, Object>();
|
||||
messageRegionFactoryBean.setBeanName("messageStoreRegion");
|
||||
messageRegionFactoryBean.setAttributes(attributesFactoryBean.getObject());
|
||||
messageRegionFactoryBean.setCache(cache);
|
||||
messageRegionFactoryBean.afterPropertiesSet();
|
||||
this.messageStoreRegion = messageRegionFactoryBean.getObject();
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new IllegalArgumentException("Failed to initialize Gemfire Region", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object doRetrieve(Object id) {
|
||||
Assert.notNull(id, "'id' must not be null");
|
||||
@@ -89,20 +109,4 @@ public class GemfireMessageStore extends AbstractKeyValueMessageStore implements
|
||||
return keyList;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
try {
|
||||
RegionAttributesCreation attributes = new RegionAttributesCreation();
|
||||
attributes.setIgnoreJTA(ignoreJta);
|
||||
RegionFactoryBean<Object, Object> messageRegionFactoryBean = new RegionFactoryBean<Object, Object>();
|
||||
messageRegionFactoryBean.setBeanName("messageStoreRegion");
|
||||
messageRegionFactoryBean.setAttributes(attributes);
|
||||
messageRegionFactoryBean.setCache(cache);
|
||||
messageRegionFactoryBean.afterPropertiesSet();
|
||||
|
||||
this.messageStoreRegion = messageRegionFactoryBean.getObject();
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("Failed to initialize Gemfire Region", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user