private void handleResponse(WorkerHeartbeatResponse resp) {
		if(resp.getCommand() == Cmd.IDLE) {
			currentTask = null;
		} else if(resp.getCommand() == Cmd.POLL) {
			//Do nothing
		} else if(resp.getCommand() == Cmd.RUN_NEW_TASK) {
			//TODO:
			//Spawn a new thread and start running the task
			//On any exception, log and fail the complete process.
			setCurrentTask(resp.getNewTask());

            if(currentTask.getTaskType() == TaskType.MAP){
                es.submit(new MapWorker(currentTask));
            } else if (currentTask.getTaskType() == TaskType.REDUCE){
                es.submit(new ReduceWorker(currentTask));
            }

		} else if(resp.getCommand() == Cmd.SHUTDOWN) {
			System.exit(0);
		}
	}