@Override public void close() { try { closeConnection(); } finally { isClosed = true; } }
protected Connection getConnection() throws Exception { long currTime = System.nanoTime(); if (currTime - connLastUsed > CONN_TIME_OUT) { synchronized (this) { Connection tmpConn = factory.call(); closeConnection(); connLastUsed = System.nanoTime(); return conn = tmpConn; } } else { connLastUsed = currTime; return conn; } }