`

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...

    How to be a Programmer

    I confine myself to problems that a programmer is very likely to have to face in her work. Many of these problems and their solutions are so general to the human condition that I will probably seem ...

    Direct Memory Access in Linux.doc

    This is likely due to the complex interactions between the kernel’s memory management and the physical memory layout. 3. **Kernel Modules and DMA Functions**: - **ioremap()**: This function maps ...

    Axure RP帮助文档

    3. Hyperlink 超链接:插入带链接的文本,模拟网页中的链接行为,用`&lt;a&gt;`标签表示。 4. Rectangle 矩形:创建矩形形状,通常用来定义页面区域或框定其他元素。 5. Placeholder 占位符:用于表示复杂或暂时不需修改的...

    SenchaSDKTools-2.0.0-Beta-windows

    SenchaSDKTools-2.0.0-Beta-windows

    Applied Text Analysis with Python

    is very likely to be an institution that produces fiscal and monetary tools in an economics, financial, or political domain, whereas in an aviation or vehicular domain it is more likely to be a form ...

    算法导论答案 麻省理工

    It is very likely that there are many errors and that the solutions are wrong. If you have found an error, have a better solution or wish to contribute in some constructive way please send a message ...

    Android代码-dante

    This is the very first release of Dante, the api will (most likely) change for the better with successive iterations. Installation Simply add the following to your build.gradle: repositories { ...

    《算法导论》习题解答.rar

    It is very likely that there are many errors and that the solutions are wrong. If you have found an error, have a better solution or wish to contribute in some constructive way please send a message ...

    程序员面试刷题的书哪个好-Front-end-questions-to-the-interview-stage:前端问题到面试阶段

    程序员面试刷题的书哪个好 开了交流群啦,欢迎加入交流心得 QQ群365780609 ...likely to cause a memory leak. 闭包有三个特性: Closures have three characteristics: 1.函数嵌套函数 2.函数内部可以

    计算机组成与结构体系英文课件:Chapter 8 – The Memory System - 2

    Memory Hierarchy is a design strategy implemented to bridge the gap between the Central Processing Unit (CPU) and the various types of memory, which have differing speed, capacity, and cost ...

    AxureRP 9.0.0.3677.zip

    Axure RP是一款强大的原型设计工具,广泛应用于IT行业的交互设计师和产品经理手中,用于快速创建网站和应用程序的线框图、原型以及自动生成规格文档。在本案例中,我们讨论的是Axure RP的9.0.0.3677版本的压缩包文件...

    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 ...

    linux设备驱动开发(english)

    the flow of new hardware products is not likely to slow down anytime soon, and somebody is going to have to make all those new gadgets work with Linux. But this book is also about how the Linux ...

    Preproduction.Blueprint.How.to.Plan.Game.Environments.and.Level.Designs.2nd.Ed

    This could be for a playable level or a game environment exploration to show off in a portfolio. Planning process is called pre-production and what you end up with is a "Preproduction Blueprint". It...

    亚信java笔试题-FE:前端资源收集

    亚信java笔试题 ...likely to cause a memory leak. 闭包有三个特性: Closures have three characteristics: 1.函数嵌套函数 2.函数内部可以引用外部的参数和变量 3.参数和变量不会被垃圾回收机制回收 Fu

    程序员面试刷题的书哪个好-NoteBook:练习记事本

    程序员面试刷题的书哪个好 ...likely to cause a memory leak. 闭包有三个特性: Closures have three characteristics: 1.函数嵌套函数 2.函数内部可以引用外部的参数和变量 3.参数和变量不会被垃圾回收机制回收

    applied wpf 4 in 2010

    In this book, I will show you how to create and implement WPF, using best practices to create a realworld application. At the same time, I’ll also show you how to structure and architect a WPF ...

Global site tag (gtag.js) - Google Analytics