⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 genericpoolmanager.java

📁 Java Database connection pool
💻 JAVA
字号:
/* *  PoolMan Java Object Pooling and Caching Library *  Copyright (C) 1999-2001 The Code Studio * *  This library is free software; you can redistribute it and/or *  modify it under the terms of the GNU Lesser General Public *  License as published by the Free Software Foundation; either *  version 2 of the License, or (at your option) any later version. * *  This library is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU *  Lesser General Public License for more details. * *  The full license is located at the root of this distribution *  in the LICENSE file. */package com.codestudio.util;import com.codestudio.PoolManConstants;import java.util.Enumeration;/** * An extension of PoolManager that transforms it into a singleton. */public class GenericPoolManager extends PoolManager {    private String configFile = PoolManConstants.XML_CONFIG_FILE;    private static GenericPoolManager myself = new GenericPoolManager();    public static GenericPoolManager getInstance() {        return myself;    }    private void assertLoaded() {        if (this.pools.size() < 1) {            try {                synchronized (GenericPoolManager.class) {                    if (this.pools.size() < 1)                        new com.codestudio.management.PoolManBootstrap(this.configFile);                }            } catch (Exception e) {                throw new RuntimeException("Fatal Error while attempting " + " to Configure PoolMan: " + e.getMessage() + " " + e.toString());            }        }    }    public GenericPool createPool(PoolMetaData metad) {        GenericPool gpool = new GenericPool(metad);        addPool(metad.getName(), gpool);        return gpool;    }    /**     * Overridden implementation ensures the config is loaded.     */    public ObjectPool getPool(String name) {        assertLoaded();        return super.getPool(name);    }    /**     * Overridden implementation ensures the config is loaded.     */    public Enumeration getAllPoolnames() {        assertLoaded();        return super.getAllPoolnames();    }    public Object requestObject() {        assertLoaded();        return super.requestObject();    }    public Object requestObject(String poolName) {        assertLoaded();        return super.requestObject(poolName);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -