由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Re: connection pool
相关主题
can applet implements runnable?问个Thread 的问题,java certificate里的
Can Java thread return a value?●●●●紧急求助JAVA初级问题,今天project due●●●●
java的接口runnable能这么 create thread 吗?
请教一个多线程的问题implements runable 和 extends thread
新手求教 BufferedReader.readLine()几个问题
这道题该走什么路一个基本问题。
Re: How to showStatus in Applet?关于inner class的继承
ZT: 关于性爱的多线程问题研究(一)线程问题。
相关话题的讨论汇总
话题: param话题: private话题: connection话题: username话题: boolean
进入Java版参与讨论
1 (共1页)
v**o
发帖数: 64
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
m******t
发帖数: 2416
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
1 (共1页)
进入Java版参与讨论
相关主题
线程问题。新手求教 BufferedReader.readLine()
Question: reflection and generics这道题该走什么路
新手问一个多线程的问题Re: How to showStatus in Applet?
想听本版对下面这段话的点评ZT: 关于性爱的多线程问题研究(一)
can applet implements runnable?问个Thread 的问题,java certificate里的
Can Java thread return a value?●●●●紧急求助JAVA初级问题,今天project due●●●●
java的接口runnable能这么 create thread 吗?
请教一个多线程的问题implements runable 和 extends thread
相关话题的讨论汇总
话题: param话题: private话题: connection话题: username话题: boolean