parent
40dd098b6e
commit
e4f53430a6
@ -1,33 +0,0 @@
|
|||||||
package com.dsideal.baseService.Listener;
|
|
||||||
|
|
||||||
|
|
||||||
import com.mysql.cj.jdbc.AbandonedConnectionCleanupThread;
|
|
||||||
|
|
||||||
import javax.servlet.ServletContextEvent;
|
|
||||||
import javax.servlet.ServletContextListener;
|
|
||||||
import javax.servlet.annotation.WebListener;
|
|
||||||
import java.sql.Driver;
|
|
||||||
import java.sql.DriverManager;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.Enumeration;
|
|
||||||
|
|
||||||
@WebListener
|
|
||||||
public class FixTomcatServletContextListener implements ServletContextListener {
|
|
||||||
public void contextInitialized(ServletContextEvent sce) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void contextDestroyed(ServletContextEvent sce) {
|
|
||||||
Enumeration<Driver> drivers = DriverManager.getDrivers();
|
|
||||||
Driver d = null;
|
|
||||||
while (drivers.hasMoreElements()) {
|
|
||||||
try {
|
|
||||||
d = drivers.nextElement();
|
|
||||||
DriverManager.deregisterDriver(d);
|
|
||||||
System.out.println(String.format("ContextFinalizer:Driver %s deregistered", d));
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
System.out.println(String.format("ContextFinalizer:Error deregistering driver %s", d) + ":" + ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AbandonedConnectionCleanupThread.checkedShutdown();
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue