poolcleaner.java

来自「用JSP+ORACLE写的 公司个人信息网络管理系统(JSP).」· Java 代码 · 共 55 行

JAVA
55
字号
package oa.main;

import java.awt.event.*;

public class PoolCleaner
    extends Thread
    implements ActionListener 
{
	//设置定时器
	javax.swing.Timer timer = null ;
	DealString ds = new DealString();
	
	public PoolCleaner ( ) 
	{
		//分钟
		int interval = 30;
		try
		{
			interval = Integer.parseInt( Configuration.DB_SESSION ) ;
		}catch(Exception e){}

		//毫秒:1分钟=60秒*1000毫秒
		interval = interval * 60 * 1000 ;
		timer = new javax.swing.Timer ( interval , this ) ;
		timer.start();
	}
	
	//定时器事件
	public void actionPerformed ( ActionEvent e )
	{
		deal();
		timer.restart ( ) ;
	}
	
	public synchronized void deal ( )
	{
		////////////////////////////////////////要修改

		if(Configuration.DB_LOGLEVEL.equals("2")||Configuration.DB_LOGLEVEL.equals("4"))
		{
			System.out.println( "\r\n\r\n" + ds.getDateTime ( ).substring ( 11 , 19 ) + "  \\_清理连接池_/");
		}
		Configuration.connMgr.cleanAllConn(Configuration.ConnectionPoolName);
		
		if(Configuration.DB_LOGLEVEL.equals("2")||Configuration.DB_LOGLEVEL.equals("4"))
		{
			DataBase.showConnNUM();
			//System.out.println("\r\n");
		}

		////////////////////////////////////////
	}

}

⌨️ 快捷键说明

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