4. mud study InputDriver
package driver; public class InputDriver extends Thread{ private ConnectionList connectionList; public InputDriver(ConnectionList cl) { // TODO Auto-generated constructor stub connectionList = cl; start(); } @Override public void run() { // TODO Auto-generated method stub while(true){ try { for(Connection conn : connectionList.getConnectionList()){ if(conn.getInput().ready()){ String input = conn.getInput().readLine(); if(input !=null){ System.out.println("inputDriver : "+input); conn.getInputBuffer().addBuff(input); } } } } catch (Exception e) { // TODO: handle exception } try { sleep(5); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }
=================================================================================================================