private static void waitForConnection() {
		// waiting will be set true through notifyfreeconnection
		waiting = true;

		double delay = 0;

		while (waiting) {

			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				// Nothing
			}

			delay += 0.1;

			if (delay == WARN_TIME) {
				System.err
						.println("client is pending for databseconnection for more than "
								+ WARN_TIME
								+ " seconds now. - check if all connections are closed correctly");
			}

			if (delay == ERROR_TIME) {
				throw new DBException(
						"client is pending for databseconnection for more than "
								+ ERROR_TIME
								+ " seconds now. - check if all connections are closed correctly");
			}
		}
	}