哪个高手给看下这个程序呢!那里出错了!
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: DBConnectionManager.java
package net.xzwz.db;
import java.sql.*;
import java.util.*;
import java.util.Date;
// Referenced classes of package net.jspcn.db:
// DBConnectionManager
class DBConnectionPool
{
private int checkedOut;
private Vector freeConnections;
private int maxConn;
private String name;
private String password;
private String URL;
private String user;
public synchronized void freeConnection(Connection connection)
{
freeConnections.addElement(connection);
checkedOut--;
notifyAll();
}
public synchronized Connection getConnection()
{
Connection connection = null;
if(freeConnections.size() > 0)
{
connection = (Connection)freeConnections.firstElement();
freeConnections.removeElementAt(0);
try
{
if(connection.isClosed())
{
DBConnectionManager.access$0(DBConnectionManager.this, "从连接池" + name + "删除一个无效连接");
connection = getConnection();
}
}
catch(SQLException _ex)
{
DBConnectionManager.access$0(DBConnectionManager.this, "从连接池" + name + "删除一个无效连接");
connection = getConnection();
}
} else
if(maxConn == 0 || checkedOut < maxConn)
connection = newConnection();
if(connection != null)
checkedOut++;
return connection;
}
public synchronized Connection getConnection(long l)
{
long l1 = (new Date()).getTime();
Connection connection;
while((connection = getConnection()) == null)
{
try
{
wait(l);
}
catch(InterruptedException _ex) { }
if((new Date()).getTime() - l1 >= l)
return null;
}
return connection;
}
private Connection newConnection()
{
Connection connection = null;
try
{
if(user == null)
connection = DriverManager.getConnection(URL);
else
connection = DriverManager.getConnection(URL, user, password);
DBConnectionManager.access$0(DBConnectionManager.this, "连接池" + name + "创建一个新的连接");
}
catch(SQLException sqlexception)
{
DBConnectionManager.access$1(DBConnectionManager.this, sqlexception, "无法创建下列URL的连接: " + URL);
return null;
}
return connection;
}
public synchronized void release()
{
for(Enumeration enumeration = freeConnections.elements(); enumeration.hasMoreElements();)
{
Connection connection = (Connection)enumeration.nextElement();
try
{
connection.close();
DBConnectionManager.access$0(DBConnectionManager.this, "关闭连接池" + name + "中的一个连接");
}
catch(SQLException sqlexception)
{
DBConnectionManager.access$1(DBConnectionManager.this, sqlexception, "无法关闭连接池" + name + "中的连接");
}
}
freeConnections.removeAllElements();
}
public DBConnectionPool(String s, String s1, String s2, String s3, int i)
{
freeConnections = new Vector();
name = s;
URL = s1;
user = s2;
password = s3;
maxConn = i;
}
}