public ConnectionWrapper getConnectionWrapper() throws SQLException
	{
		synchronized (this.mutex)
		{
			int x = this.lastConnection;
			ConnectionWrapper res = null;
			for (int y = 0; y < pool.size(); y++)
			{
				x++;
				x %= pool.size();
				if (!pool.get(x).isTaken())
				{
					res = pool.get(x);
					res.setTaken(true);
					this.lastConnection = x;
					break;
				}
			}
			if (res == null)// try increasing the pool size if no connection was available
			{
				this.increasePoolSizePercent(10);// increase poolsize with
													// 10%
				x = this.lastConnection;
				for (int y = 0; y < pool.size(); y++)
				{
					x++;
					x %= pool.size();
					if (!pool.get(x).isTaken())
					{
						res = pool.get(x);
						res.setTaken(true);
						this.lastConnection = x;
						break;
					}
				}
			}
			if (res == null)
			{
				LOGGER.warning("Pool size increase failed, or something else went wrong.");
			}
			return res;
		}
	}