MCPcopy Create free account
hub / github.com/apache/tomcat / close

Method close

java/org/apache/catalina/realm/DataSourceRealm.java:345–368  ·  view source on GitHub ↗

Close the specified database connection. @param dbConnection The connection to be closed

(Connection dbConnection)

Source from the content-addressed store, hash-verified

343 * @param dbConnection The connection to be closed
344 */
345 protected void close(Connection dbConnection) {
346
347 // Do nothing if the database connection is already closed
348 if (dbConnection == null) {
349 return;
350 }
351
352 // Commit if not auto committed
353 try {
354 if (!dbConnection.getAutoCommit()) {
355 dbConnection.commit();
356 }
357 } catch (SQLException e) {
358 containerLog.error(sm.getString("dataSourceRealm.commit"), e);
359 }
360
361 // Close this database connection, and log any errors
362 try {
363 dbConnection.close();
364 } catch (SQLException e) {
365 containerLog.error(sm.getString("dataSourceRealm.close"), e); // Just log it here
366 }
367
368 }
369
370 /**
371 * Open the specified database connection.

Callers 4

authenticateMethod · 0.95
getPasswordMethod · 0.95
getPrincipalMethod · 0.95
getRolesMethod · 0.95

Calls 5

getAutoCommitMethod · 0.65
commitMethod · 0.65
errorMethod · 0.65
getStringMethod · 0.65
closeMethod · 0.65

Tested by

no test coverage detected