void replaceConnection(ConnectionWrapper connWrap) {
		synchronized (allConnections) {
			try {
				if (usedConnections.remove(connWrap)) {
					nrofReset++;

					//the object was indeed locked
					allConnections.remove(connWrap);
					//IMPORTANT does this result in an SQL error which breaks off the connection?
					connWrap.getConnection().close();
					System.out.println(new LogEntry(Level.CRITICAL, "Connection reset" + (connWrap.getLastStatement() != null ? " while executing '" + connWrap.getLastStatement() + '\'' : "")));
					//lets create a fresh successor
					ConnectionWrapper newConnWrap = createConnectionWrapper(dbUrl, dbUsername, dbUserpassword);
					availableConnections.add(newConnWrap);
					allConnections.add(newConnWrap);
				} else {
					nrofErrors++;
					System.out.println(new LogEntry(Level.CRITICAL, "error in connection pool: attempt to close a Connection that does not exist in pool"));
				}
			} catch (SQLException sqle) {
				//happens if db unreachable
				//connection will be lost for the time being
				nrofErrors++;
				System.out.println(new LogEntry(Level.CRITICAL, "can not create new connection to " + dbUrl + " unreachable or useless connection settings", sqle));
			}
			try {
				if (!connWrap.isClosed()) {
					connWrap.getConnection().close();
				}
			} catch (SQLException sqle) {
				nrofErrors++;
				System.out.println(new LogEntry(Level.CRITICAL, "", sqle));
			}
		}
	}
void replaceConnection ( ConnectionWrapper connWrap ) { synchronized ( allConnections ) { try { if ( usedConnections . remove ( connWrap ) ) { nrofReset ++ ; allConnections . remove ( connWrap ) ; connWrap . getConnection ( ) . close ( ) ; System . out . println ( new LogEntry ( Level . CRITICAL , "Connection reset" + ( connWrap . getLastStatement ( ) != null ? " while executing '" + connWrap . getLastStatement ( ) + '\'' : "" ) ) ) ; ConnectionWrapper newConnWrap = createConnectionWrapper ( dbUrl , dbUsername , dbUserpassword ) ; availableConnections . add ( newConnWrap ) ; allConnections . add ( newConnWrap ) ; } else { nrofErrors ++ ; System . out . println ( new LogEntry ( Level . CRITICAL , "error in connection pool: attempt to close a Connection that does not exist in pool" ) ) ; } } catch ( SQLException sqle ) { nrofErrors ++ ; System . out . println ( new LogEntry ( Level . CRITICAL , "can not create new connection to " + dbUrl + " unreachable or useless connection settings" , sqle ) ) ; } try { if ( ! connWrap . isClosed ( ) ) { connWrap . getConnection ( ) . close ( ) ; } } catch ( SQLException sqle ) { nrofErrors ++ ; System . out . println ( new LogEntry ( Level . CRITICAL , "" , sqle ) ) ; } } }
Closes the connection and replaces it in the pool
To be invoked by ConnectionWrapper and StandardConnectionPool only only

@param connWrap