Added ServletContextListener to intercept start and stop of the service
This commit is contained in:
parent
507c65cfa9
commit
35e9883a38
|
@ -0,0 +1,23 @@
|
|||
package org.gcube.informationsystem.resourceregistry;
|
||||
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ResourceRegistryContextListener implements ServletContextListener {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ResourceRegistryContextListener.class);
|
||||
|
||||
@Override
|
||||
public void contextDestroyed(ServletContextEvent servletContextEvent) {
|
||||
logger.info("Resource Registry is going to be stopped");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contextInitialized(ServletContextEvent servletContextEvent) {
|
||||
logger.info("Resource Registry is going to be started");
|
||||
}
|
||||
|
||||
}
|
|
@ -8,4 +8,7 @@
|
|||
<servlet-name>org.gcube.informationsystem.resourceregistry.ResourceInitializer</servlet-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<listener>
|
||||
<listener-class>org.gcube.informationsystem.resourceregistry.ResourceRegistryContextListener</listener-class>
|
||||
</listener>
|
||||
</web-app>
|
Loading…
Reference in New Issue