5. mud study UpdateDriver (exit, quit)
package driver; public class UpdateDriver extends Thread{ private ConnectionList connectionList; public UpdateDriver(ConnectionList cl) { connectionList = cl; start(); } @Override public void run() { // TODO Auto-generated method stub while(true){ for(Connection conn : connectionList.getConnectionList()){ CustomBuffer cbff = conn.getInputBuffer(); String input = cbff.getBuff(); if(null != input && !"".equals(input)){ String[] cmd = input.split(" "); if("quit".equals(cmd[0])||"exit".equals(cmd[0])){ new ConnectionBreaker(connectionList, conn); } } } try { sleep(5); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }
===========================================