private RegisterResult registerSlave(InetAddress ip, int port, StringBuilder name) {
		String slaveName = null;
		SlaveInfo info = new SlaveInfo(port, ip);
		Set<String> nodeNameSet = this.slaveTable.keySet();
		for (String nodeName : nodeNameSet) {
			if (this.slaveTable.get(nodeName).getIP().equals(info.getIP()) &&
					this.slaveTable.get(nodeName).getListenPort() == info.getListenPort()) {
				if (slaveTable.get(nodeName).getNodeStatus() == NodeStatus.TERMINATED) {
					System.out.println("\t\tSlave.registerSlave():\tRefresh old slave node:" + slaveName);
					info.setNodeStatus(NodeStatus.RUNNING);
					info.setNodeName(nodeName);
					this.slaveTable.put(nodeName, info);
					name.append(nodeName);
					return RegisterResult.REFRESH;
				} else {
					System.out.println("\t\tSlave.registerSlave():\tReceived an invalid registration");
					return RegisterResult.INVALID;	
				}
			}
		}
		
		slaveName = "slave" + (this.slaveNum);
		this.slaveNum++;
		info.setNodeName(slaveName);
		info.setNodeStatus(NodeStatus.RUNNING);
		slaveTable.put(slaveName, info);
		System.out.println("\t\tSlave.registerSlave():\tRegister a new slave node:" + slaveName);
		name.append(slaveName);
		return RegisterResult.SUCCEED;
	}