@Override
	public void run() {
		List<Task> tasks;
		while ((tasks = getProducerService().generateTasks(batchSize)).size() > 0) {
			try {	
				for (Task task : tasks) {
					getQueue().put(task);
				}
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		System.out.println("producer: sending shutdown");
		try {
			for (int i = 0; i < nbConsumers; i++) {
				getQueue().put(Task.SHUTDOWN_TASK);
			}
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		System.out.println("producer: finished");
	}