Download this file
53 lines (45 with data), 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 | /**
*
*/
package com.handjoys.dbpool;
/**
* <b></b>
* @author 汉娱网络.技术部.wanggl
*
*/
public class MaintenanceThread implements Runnable {
/**
* 休息十秒,由于休息一秒,运行的次数太大
*/
private int threadSleep=10*60*1000;
private Thread t;
public MaintenanceThread()
{
t=new Thread(this);
}
public void start()
{
try
{
t.start();
}catch(Exception e){
}
}
/**
* 连接池中的维护线程的运行
* @see java.lang.Runnable#run()
*/
public void run() {
// TODO Auto-generated method stub
while(true)
{
DBProxy.doMantence();
try{
// 本线程sleep x毫秒,把时间片释放一下
Thread.currentThread().sleep(threadSleep);
}catch(InterruptedException ie) {
// 无需处理,该异常表示其他线程中断了本线程的sleep状态
}
}
}
}
|
×
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.