private int getPrinter() {
		int ret = -1;

		// try to get an available printer
		try {
			lockPrinters.lock();
			for (int i = 0; i < 3; i++) {
				if (freePrinters[i]) {
					ret = i;
					freePrinters[i] = false;
					break;
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			lockPrinters.unlock();
		}
		return ret;
	}