public void collectPartition() 
			throws UnknownHostException, IOException, InterruptedException, ClassNotFoundException {

		for (PartitionEntry taskEntry : this.task.getEntries()) {
			
			String localFileName = this.task.localReducerFileNameWrapper(taskEntry.getTID());
			File localFile = new File(localFileName);
			
			if (taskEntry.getHost().equals((Inet4Address.getLocalHost().getHostAddress()))) { 
				
				if (MapReduce.Core.DEBUG) {
					System.out.println("RunReducer.collectPartition(): Get file from local file system");
				}
				
				String srcFileName = this.task.remoteFileNameWrapper(this.task.getSEQ(), taskEntry.getTID());
				
				File srcFile = new File(this.task.getLocalMapperFilePrefix() + "/" + srcFileName);  //Mapper file
				
				if (!srcFile.exists()) {
					throw new IOException("Cannot found mapper file on local");
				} else {
					srcFile.renameTo(localFile);
				}
				
			} else {
				
				if (MapReduce.Core.DEBUG) {
					System.out.println("RunReducer.collectPartition(): Get file from other TaskTracker server.");
				}
				
				FileOutputStream fout = new FileOutputStream(localFile);
			
				Socket soc = new Socket(taskEntry.getHost(), taskEntry.getPort());
				PrintWriter out = new PrintWriter(soc.getOutputStream(), true);
				BufferedInputStream in = new BufferedInputStream(soc.getInputStream());
				
				String request = String.format("mapper-file\n%s\n", this.task.remoteFileNameWrapper(this.task.getSEQ(), taskEntry.getTID()));
				//System.out.println("REQUESTING:" + request + "\tIP=" + taskEntry.getHost() + "\tTO:" + this.task.localReducerFileNameWrapper(taskEntry.getTID()));
				out.write(request.toCharArray());
				out.flush();
			
				byte[] buff = new byte[BUFF_SIZE];
				int readBytes = 0;
				
				while ((readBytes = in.read(buff)) != -1) {
					fout.write(buff, 0, readBytes);
				}
				
				in.close();
				out.close();
				fout.close();
				soc.close();
			}
		}

	}