code: ConnectionWrapper obtainConnection() {
  		synchronized (allConnections) {
  			//fails if connection pool not started
  			if (!availableConnections.isEmpty()) {
  				//retrieve and remove first connection from list
  				//  since released connections are added to the back, connections will rotate
  				ConnectionWrapper connWrap = (ConnectionWrapper) availableConnections.remove(0);
  				usedConnections.add(connWrap);
  				if (usedConnections.size() > maxNrOfConcurrentConnectionsCounted) {
  					maxNrOfConcurrentConnectionsCounted = usedConnections.size();
  				}
  				return connWrap;
  			} else {
  				//create one if max not reached
  				//this also restores lost connections
  				if ((allConnections.size() < initialNrofConnections) || (allConnections.size() < maxNrofConnections)) {
  					try {
  						ConnectionWrapper connWrap = createConnectionWrapper(dbUrl, dbUsername, dbUserpassword);
  
  						allConnections.add(connWrap);
  						usedConnections.add(connWrap);
  
  						System.out.println(new LogEntry("Creating new Connection, now " + allConnections.size() + " in use"));
  
  						return connWrap;
  					} catch (SQLException sqle) {
  						//happens if db unreachable
  						//connection will be lost for the time being
  						nrofErrors++;
  						System.out.println(new LogEntry("Cannot create new connection to " + dbUrl + " unreachable or useless connection settings", sqle));
  						throw new ResourceException("Cannot create new connection to " + dbUrl + " unreachable or useless connection settings", sqle);
  					}
  				} else {
  					System.out.println(new LogEntry("maximum nr of connections (" + maxNrofConnections + ") reached while Application demands another"));
  				}
  				return null;
  			}
  		}
  	}
docs: To be invoked by ConnectionWrapper and StandardConnectionPool only only
  
  @return A database connection (wrapped in a class that implements Connection as well)