private static synchronized long pop() throws IOException {
		String id = null;

		// check unfinished first
		if (!unfinished_queue.isEmpty())
			return unfinished_queue.poll();

		id = queueReader.readLine();

		if (id == null)
			return -1;

		return new Long(id);
	}