While((line = bufferFileReader.readLine())!=null)
printWriter.println(line);
fileReader.close();
printWriter.close();
outputReader.close();
}catch(Exception e){
System.out.println("Exception occured when handiling a client connection.");
}
}
//将请求的socket链入请求队列
public static void processRequest(Socket requestSocket){
synchronized(pool){
pool.add(pool.size(),requestSocket)
pool.notifyAll();
}
}
//主线程
public void run(){
while(true){
synchronized(pool){
while(pool.isEmpty()){
try{
pool.wait();
}catch(){
return;
}
}
socket = (Socket)pool.remove(0);
}
handleConnection();
}
}