Merge pull request #105 from stianst/master

KEYCLOAK-53
This commit is contained in:
stianst 2013-11-16 01:17:23 -08:00
commit cd314acb27
3 changed files with 30 additions and 6 deletions

View file

@ -20,7 +20,11 @@
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<listener>
<listener-class>org.keycloak.services.listeners.KeycloakSessionDestroyListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

View file

@ -0,0 +1,25 @@
package org.keycloak.services.listeners;
import org.keycloak.models.KeycloakSessionFactory;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
/**
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
*/
public class KeycloakSessionDestroyListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent sce) {
}
@Override
public void contextDestroyed(ServletContextEvent sce) {
KeycloakSessionFactory factory = (KeycloakSessionFactory) sce.getServletContext().getAttribute(KeycloakSessionFactory.class.getName());
if (factory != null) {
factory.close();
}
}
}

View file

@ -83,11 +83,6 @@ public class KeycloakApplication extends Application {
return factory;
}
@PreDestroy
public void destroy() {
factory.close();
}
@Override
public Set<Class<?>> getClasses() {
return classes;