Update to Spring Data Hopper

Fixes gh-470
This commit is contained in:
John Blum
2016-04-11 07:31:05 -07:00
committed by Rob Winch
parent 7c616a1adf
commit 2d6f505a30
20 changed files with 226 additions and 193 deletions

View File

@@ -27,8 +27,8 @@ import org.springframework.context.annotation.ImportResource;
public class Application {
public static void main(final String[] args) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
Application.class);
AnnotationConfigApplicationContext context =
new AnnotationConfigApplicationContext(Application.class);
context.registerShutdownHook();
}
}

View File

@@ -51,35 +51,32 @@ public class GemFireCacheServerReadyBeanPostProcessor implements BeanPostProcess
// tag::class[]
static {
ClientMembership
.registerClientMembershipListener(new ClientMembershipListenerAdapter() {
public void memberJoined(final ClientMembershipEvent event) {
if (!event.isClient()) {
latch.countDown();
}
ClientMembership.registerClientMembershipListener(
new ClientMembershipListenerAdapter() {
public void memberJoined(final ClientMembershipEvent event) {
if (!event.isClient()) {
latch.countDown();
}
});
}
});
}
@SuppressWarnings("all")
@Resource(name = "applicationProperties")
private Properties applicationProperties;
public Object postProcessBeforeInitialization(Object bean, String beanName)
throws BeansException {
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
if (bean instanceof PoolFactoryBean || bean instanceof Pool) {
String host = getServerHost(DEFAULT_SERVER_HOST);
Assert.isTrue(waitForCacheServerToStart(host, this.port),
String.format(
"GemFire Server failed to start [host: '%1$s', port: %2$d]%n",
host, this.port));
String.format("GemFire Server failed to start [host: '%1$s', port: %2$d]%n",
host, this.port));
}
return bean;
}
public Object postProcessAfterInitialization(Object bean, String beanName)
throws BeansException {
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
if (bean instanceof PoolFactoryBean || bean instanceof Pool) {
try {
latch.await(DEFAULT_WAIT_DURATION, TimeUnit.MILLISECONDS);
@@ -157,4 +154,5 @@ public class GemFireCacheServerReadyBeanPostProcessor implements BeanPostProcess
return condition.evaluate();
}
}