@Override
	public void run() {
		// TODO Auto-generated method stub
		while (true) {
			try {
				ClientData clientData = (ClientData) input.readObject();
				String name = clientData.getName();
				String message = clientData.getMessage();
				boolean quitRequest = clientData.isCloseRequest();
				if (quitRequest) {
					break;
				}
				
				StringBuffer tmp = records.get(name);
				if (tmp == null) {
					records.put(name, new StringBuffer(message));
				} else {
					tmp.append(System.getProperty("line.separator"));
					tmp.append(message);
				}
				//System.out.println(records.get(name));
			} catch (IOException e) {
				// TODO Auto-generated catch block
				System.err.println(e.getMessage());
				System.exit(1);
			} catch (ClassNotFoundException e) {
				System.err.println(e.getMessage());
				System.exit(1);
			}
			
		}
		
		try {
			if (output != null) {
				output.close();
			}
			
			if (input != null) {
				input.close();
			}
			
			if (!clientSocket.isClosed()){
				clientSocket.close();
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			System.err.println(e.getMessage());
			System.exit(1);
		}
		
	}