📄 poolskimmerthread.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;/** * PoolSkimmer manages the clean up of dead and expired objects * floating around the pool. *<p> * Another Thread, LifeGuardThread, also monitors ObjectPool * instances. LifeGuardThread is more humane; it attempts to * send troubled objects back to their pools. PoolSkimmerThread * simply disposes of already dead or useless objects. *<br> * @see LifeGuardThread */public class PoolSkimmerThread implements Runnable { private long timeout; private ObjectPool pool; public PoolSkimmerThread(int skimmerSecs, ObjectPool pool) { this.timeout = (skimmerSecs * 1000); this.pool = pool; } public void run() { for (; ;) { try { Thread.sleep(this.timeout); } catch (InterruptedException e) { } this.pool.cleanUp(); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -