MCPcopy Create free account
hub / github.com/cmu-db/benchbase / isConnectionOK

Method isConnectionOK

src/main/java/com/oltpbenchmark/util/SQLUtil.java:734–741  ·  view source on GitHub ↗

Checks to see if a connection looks OK. @param conn @param checkValid Whether or not to issue a isValid() check on the connection. Note: this can be expensive since it may actually issue a noop query. @return boolean @throws SQLException

(Connection conn, boolean checkValid)

Source from the content-addressed store, hash-verified

732 * @throws SQLException
733 */
734 public static boolean isConnectionOK(Connection conn, boolean checkValid) throws SQLException {
735 boolean ret = conn != null && !conn.isClosed();
736 if (checkValid) {
737 // isValid() can be expensive, so only do it if we have to and timeout after 1 second
738 ret = ret && conn.isValid(1);
739 }
740 return ret;
741 }
742
743 /**
744 * Checks to see if a connection looks OK without issuing an isValid() check.

Callers 1

doWorkMethod · 0.95

Calls 1

isClosedMethod · 0.80

Tested by

no test coverage detected