How can CacheServer run via Spring Gemfire API?
I can run cacheserver via batch command. It works. Now I want to integrate spring into gemfire and launch a cacheserver using spring gemfire API. It can be successfully launched and after that it stops soon. So can anyone can demonstrate any example about launching the cacheserver via spring gemfire API?
Code:
private CacheServer server;
private ConfigurableApplicationContext context;
context = new ClassPathXmlApplicationContext("classpath:/conf/spring/serverContext.xml");
context.registerShutdownHook();
if (server == null)
server = (CacheServer)context.getBean("BookPocCacheServer");
server.start();
serverContext.xml
Code:
<gfe:cache id="BookPocServerCache" properties-ref="serverCacheProbs" cache-xml-location="classpath:/conf/spring/serverCache.xml" />
<util:properties id="serverCacheProbs" location="classpath:/conf/spring/serverCache.properties" />
<gfe:cache-server id="BookPocCacheServer" bind-address="192.168.11.2" auto-startup="true" cache-ref="BookPocServerCache"/>
serverCache.properties
Code:
bind-address=192.168.11.2
mcast-port=0
start-locator=192.168.11.2[12345]
log-level=info
And the output log is:
INFO - Starting beans in phase 2147483647
INFO - Closing org.springframework.context.support.ClassPathXmlAp plicationContext@a97b0b: startup date [Mon Sep 26 22:13:54 CST 2011]; root of context hierarchy
INFO - Stopping beans in phase 2147483647
Why the bean will be stopping after it starts successfully?