avatar
Re: connection pool# Java - 爪哇娇娃
v*o
1
import java.sql.*;
import java.util.*;
/**
* 连接池的实现
* @author: vago
*/
public class ConnectionPool implements Runnable {
private String driver, url, username, password;
private int maxConnections;
private boolean waitIfBusy;
private Vector availableConnections, busyConnections;
private boolean connectionPending = false;
/**
* 构造子
* @param driver java.lang.String
* @param url java.lang.String
* @param username java.lang.String
* @param password jav
avatar
m*t
2
There are still several issues left in the code:
1.why is it necessary to create a new thread every time to
make a new connection?
2.the free() method relies on one assumption that
the implementation class
of Connection implement equals() properly. Or busy connections
won't be released correctly.
3.the notifyAll() call in the middle of getConnection
doesn't make much sense, because the caller thread will keep
the lock and call getConnection again, while all other threads
wakened up will simply h
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。