Post

3 followers Follow
0
Avatar

Shutdown Gemfire Server in a Tomcat Appliation

Hi,

I`m developing a application that is starting up a Gemfire Server in a Tomcat. I create three nodes and I have a locator that use to distributed the entry on the regions. This is working fine, but I need to know which is the best way to shutdown the tomcat appliacion and the gemfire server.

Because, I have in the node a async-event-listener that persist transactions in DB, this listener is working only in one node (primary) at the same time, and when I shutdow the tomcat of the primary node I lost transactions.

 

Thanks

Juan Manuel Romera Ferrio

Please sign in to leave a comment.

2 comments

0
Avatar

Hi Juan,

I'd suggest you register a ServletContextListener and close the cache when the context is about to be destroyed.

However, I'd also urge you to consider simply having the Tomcat app be a GemFire client and not have it also be a GemFire server. Decoupling your architecture in this way makes it easier to reason about different components and will let you deploy code more precisely. When you need to scale your app, you can scale different layers independently.

--Jens

Jens Deppe 0 votes
0
Avatar

If the AsyncEventQueue is not persistent or HA, and it contains events when it is shut down, those events are lost. To prevent that, you could either persist the queue or make it HA. In the persistent case, when the queue is restarted, it'll pick up where it left off. In the HA case, the secondary will take over processing when the primary stops.

There is also a java system property called GatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME that if set will cause the queue processor to wait up to that many seconds for the queue to drain before stopping. Depending on how your servers are being started, set it like: -DGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME=10 or --J=-DGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME=10 for a 10 second wait.

Barry Oglesby 0 votes