`

This is very likely to create a memory leak

 
阅读更多
http://stackoverflow.com/questions/11872316/tomcat-guice-jdbc-memory-leak
public class XBasicDataSource extends DruidDataSource {

    @Override
    public void close(){
        Enumeration<Driver> drivers = DriverManager.getDrivers();
        while (drivers.hasMoreElements()) {
            Driver driver = drivers.nextElement();
            try {
                DriverManager.deregisterDriver(driver);
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

        try {
            AbandonedConnectionCleanupThread.shutdown();
        } catch (InterruptedException e) {
            //logger.warn("SEVERE problem cleaning up: " + e.getMessage());
            e.printStackTrace();
        }

        super.close();

    }
}

jdbc.dataSource=com.pandy.core.ds.XBasicDataSource
分享到:
评论

相关推荐

    微软内部资料-SQL性能优化2

    A 32-bit process is normally limited to addressing 2 gigabytes (GB) of memory, or 3 GB if the system was booted using the /3G boot switch even if there is more physical memory available. By leveraging...

    BURNINTEST--硬件检测工具

    This is a shareware program. This means that you need to buy it if you would like to continue using it after the evaluation period. Installation ============ 1) Uninstall any previous version of ...

    acpi控制笔记本风扇转速

    Fixed a possible memory leak and fault in AcpiExResolveObjectToValue during a read from a buffer or region field. (BZ 458) Fiodor Suietov. Example Code and Data Size: These are the sizes for the OS- ...

    php.ini-development

    Note: This directive is hardcoded to Off for the CLI SAPI ; Default Value: Off ; Development Value: 4096 ; Production Value: 4096 ; http://php.net/output-buffering output_buffering = 4096 ; You can ...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    items a blank line is added to the list (EnumProp.Add('')). - ADD: Added the method TEnumProp.SetEnumType, setting all enumerable type items in compliance with the Delphi type: SetEnumType...

Global site tag (gtag.js) - Google Analytics