Hazelcast Tip: Do not forget to shutdown hazelcast on context destroy?

If you use Hazelcast in a web application, you should shutdown Hazelcast instance on context destroy event.

Otherwise you may experience problem on undeploying/deploying the web container.

public class ContextListener  implements ServletContextListener {
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        }
        public void contextDestroyed(ServletContextEvent servletContextEvent) {
           yourHazelcastInstance.getLifecycleService().shutdown();
        }
    }

and web.xml

 <listener>
    <listener-class>com.hazelcast.twitshirt.ContextListener</listener-class>
    </listener>