poolcleaner.java

来自「会议流程管理系统」· Java 代码 · 共 54 行

JAVA
54
字号
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 ;
		System.out.println("  (:-:)"+interval);
		timer = new javax.swing.Timer ( interval , this ) ;
		timer.start();
		deal();
	}
	
	//定时器事件
	public void actionPerformed ( ActionEvent e )
	{
		deal();
	}
	
	public synchronized void deal ( )
	{
		////////////////////////////////////////要修改

		System.out.println( ds.getDateTime ( ).substring ( 11 , 19 ) + "  (:-:)(:-:)(:-:)(:-:)(:-:)(:-:)清空连接池了!");
		Configuration.connMgr.cleanAllConn(Configuration.ConnectionPoolName);
		
		
		DataBase.showConnNUM();
		System.out.println("\r\n\r\n");
		

		////////////////////////////////////////
		
		timer.restart ( ) ;
	}

}

⌨️ 快捷键说明

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