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

📄 genericpoolservice.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.management;import com.codestudio.util.GenericPool;import com.codestudio.util.GenericPoolManager;import com.codestudio.util.GenericPoolMetaData;import com.codestudio.util.ObjectPool;public class GenericPoolService extends ObjectPoolService implements GenericPoolServiceMBean {    protected GenericPoolMetaData genericMetadata;    public GenericPoolService() {        this.metadata = new GenericPoolMetaData();        this.genericMetadata = (GenericPoolMetaData) this.metadata;    }    public void start() throws Exception {        // Create the pool;        GenericPool pool = new GenericPool(this.genericMetadata);        // Put pool in Generic Pool Manager        GenericPoolManager.getInstance().addPool(getName(), pool);        // flip the switch        this.available = true;    }    public void stop() throws Exception {        // flip the switch        this.available = false;        // destroy the pool        GenericPool pool = (GenericPool) GenericPoolManager.getInstance().getPool(getName());        GenericPoolManager.getInstance().removePool(getName());        pool.closeAllResources();        pool = null;    }    public String getObjectType() {        return this.genericMetadata.getObjectType();    }    public void setObjectType(String s) {        this.genericMetadata.setObjectType(s);    }    public int getNumCheckedInObjects() {        ObjectPool pool = GenericPoolManager.getInstance().getPool(getName());        return pool.numCheckedInObjects();    }    public int getNumCheckedOutObjects() {        ObjectPool pool = GenericPoolManager.getInstance().getPool(getName());        return pool.numCheckedOutObjects();    }    public int getNumTotalObjects() {        ObjectPool pool = GenericPoolManager.getInstance().getPool(getName());        return pool.numTotalObjects();    }}

⌨️ 快捷键说明

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