You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by th...@apache.org on 2020/01/08 06:02:47 UTC
svn commit: r37517 [45/50] - in /dev/commons/dbutils/1.8-RC2: ./ binaries/
site/ site/apidocs/ site/apidocs/jquery/ site/apidocs/jquery/external/
site/apidocs/jquery/external/jquery/ site/apidocs/jquery/images/
site/apidocs/jquery/jszip-utils/ site/api...
Added: dev/commons/dbutils/1.8-RC2/site/jacoco/org.apache.commons.dbutils/AsyncQueryRunner.java.html
==============================================================================
--- dev/commons/dbutils/1.8-RC2/site/jacoco/org.apache.commons.dbutils/AsyncQueryRunner.java.html (added)
+++ dev/commons/dbutils/1.8-RC2/site/jacoco/org.apache.commons.dbutils/AsyncQueryRunner.java.html Wed Jan 8 06:02:46 2020
@@ -0,0 +1,692 @@
+<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>AsyncQueryRunner.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons DbUtils</a> > <a href="index.source.html" class="el_package">org.apache.commons.dbutils</a> > <span class="el_
source">AsyncQueryRunner.java</span></div><h1>AsyncQueryRunner.java</h1><pre class="source lang-java linenums">/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.dbutils;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+
+import javax.sql.DataSource;
+
+/**
+ * Executes SQL queries with pluggable strategies for handling
+ * {@code ResultSet}s. This class is thread safe.
+ *
+ * @see ResultSetHandler
+ * @since 1.4
+ */
+public class AsyncQueryRunner extends AbstractQueryRunner {
+
+ private final ExecutorService executorService;
+ private final QueryRunner queryRunner;
+
+ /**
+ * Constructor for AsyncQueryRunner which uses a provided ExecutorService and underlying QueryRunner.
+ *
+ * @param executorService the {@code ExecutorService} instance used to run JDBC invocations concurrently.
+ * @param queryRunner the {@code QueryRunner} instance to use for the queries.
+ * @since DbUtils 1.5
+ */
+<span class="fc" id="L48"> public AsyncQueryRunner(final ExecutorService executorService, final QueryRunner queryRunner) {</span>
+<span class="fc" id="L49"> this.executorService = executorService;</span>
+<span class="fc" id="L50"> this.queryRunner = queryRunner;</span>
+<span class="fc" id="L51"> }</span>
+
+ /**
+ * Constructor for AsyncQueryRunner.
+ *
+ * @param executorService the {@code ExecutorService} instance used to run JDBC invocations concurrently.
+ */
+ public AsyncQueryRunner(final ExecutorService executorService) {
+<span class="fc" id="L59"> this(null, false, executorService);</span>
+<span class="fc" id="L60"> }</span>
+
+ /**
+ * @deprecated Use {@link #AsyncQueryRunner(ExecutorService, QueryRunner)} instead.
+ * Constructor for AsyncQueryRunner that controls the use of {@code ParameterMetaData}.
+ *
+ * @param pmdKnownBroken Some drivers don't support {@link java.sql.ParameterMetaData#getParameterType(int) };
+ * if {@code pmdKnownBroken} is set to true, we won't even try it; if false, we'll try it,
+ * and if it breaks, we'll remember not to use it again.
+ * @param executorService the {@code ExecutorService} instance used to run JDBC invocations concurrently.
+ */
+ @Deprecated
+ public AsyncQueryRunner(final boolean pmdKnownBroken, final ExecutorService executorService) {
+<span class="fc" id="L73"> this(null, pmdKnownBroken, executorService);</span>
+<span class="fc" id="L74"> }</span>
+
+ /**
+ * @deprecated Use {@link #AsyncQueryRunner(ExecutorService, QueryRunner)} instead.
+ * Constructor for AsyncQueryRunner that takes a {@code DataSource}.
+ *
+ * Methods that do not take a {@code Connection} parameter will retrieve connections from this
+ * {@code DataSource}.
+ *
+ * @param ds The {@code DataSource} to retrieve connections from.
+ * @param executorService the {@code ExecutorService} instance used to run JDBC invocations concurrently.
+ */
+ @Deprecated
+ public AsyncQueryRunner(final DataSource ds, final ExecutorService executorService) {
+<span class="nc" id="L88"> this(ds, false, executorService);</span>
+<span class="nc" id="L89"> }</span>
+
+ /**
+ * @deprecated Use {@link #AsyncQueryRunner(ExecutorService, QueryRunner)} instead.
+ * Constructor for AsyncQueryRunner that take a {@code DataSource} and controls the use of {@code ParameterMetaData}.
+ * Methods that do not take a {@code Connection} parameter will retrieve connections from this
+ * {@code DataSource}.
+ *
+ * @param ds The {@code DataSource} to retrieve connections from.
+ * @param pmdKnownBroken Some drivers don't support {@link java.sql.ParameterMetaData#getParameterType(int) };
+ * if {@code pmdKnownBroken} is set to true, we won't even try it; if false, we'll try it,
+ * and if it breaks, we'll remember not to use it again.
+ * @param executorService the {@code ExecutorService} instance used to run JDBC invocations concurrently.
+ */
+ @Deprecated
+ public AsyncQueryRunner(final DataSource ds, final boolean pmdKnownBroken, final ExecutorService executorService) {
+<span class="fc" id="L105"> super(ds, pmdKnownBroken);</span>
+<span class="fc" id="L106"> this.executorService = executorService;</span>
+<span class="fc" id="L107"> this.queryRunner = new QueryRunner(ds, pmdKnownBroken);</span>
+<span class="fc" id="L108"> }</span>
+
+ /**
+ * @deprecated No longer used by this class. Will be removed in a future version.
+ * Class that encapsulates the continuation for batch calls.
+ */
+ @Deprecated
+ protected class BatchCallableStatement implements Callable<int[]> {
+ private final String sql;
+ private final Object[][] params;
+ private final Connection conn;
+ private final boolean closeConn;
+ private final PreparedStatement ps;
+
+ /**
+ * Creates a new BatchCallableStatement instance.
+ *
+ * @param sql The SQL statement to execute.
+ * @param params An array of query replacement parameters. Each row in
+ * this array is one set of batch replacement values.
+ * @param conn The connection to use for the batch call.
+ * @param closeConn True if the connection should be closed, false otherwise.
+ * @param ps The {@link PreparedStatement} to be executed.
+ */
+<span class="nc" id="L132"> public BatchCallableStatement(final String sql, final Object[][] params, final Connection conn, final boolean closeConn, final PreparedStatement ps) {</span>
+<span class="nc" id="L133"> this.sql = sql;</span>
+<span class="nc" id="L134"> this.params = params.clone();</span>
+<span class="nc" id="L135"> this.conn = conn;</span>
+<span class="nc" id="L136"> this.closeConn = closeConn;</span>
+<span class="nc" id="L137"> this.ps = ps;</span>
+<span class="nc" id="L138"> }</span>
+
+ /**
+ * The actual call to executeBatch.
+ *
+ * @return an array of update counts containing one element for each command in the batch.
+ * @throws SQLException if a database access error occurs or one of the commands sent to the database fails.
+ * @see PreparedStatement#executeBatch()
+ */
+ @Override
+ public int[] call() throws SQLException {
+<span class="nc" id="L149"> int[] ret = null;</span>
+
+ try {
+<span class="nc" id="L152"> ret = ps.executeBatch();</span>
+<span class="nc" id="L153"> } catch (final SQLException e) {</span>
+<span class="nc" id="L154"> rethrow(e, sql, (Object[])params);</span>
+ } finally {
+<span class="nc" id="L156"> close(ps);</span>
+<span class="nc bnc" id="L157" title="All 2 branches missed."> if (closeConn) {</span>
+<span class="nc" id="L158"> close(conn);</span>
+ }
+ }
+
+<span class="nc" id="L162"> return ret;</span>
+ }
+ }
+
+ /**
+ * Execute a batch of SQL INSERT, UPDATE, or DELETE queries.
+ *
+ * @param conn The {@code Connection} to use to run the query. The caller is
+ * responsible for closing this Connection.
+ * @param sql The SQL to execute.
+ * @param params An array of query replacement parameters. Each row in
+ * this array is one set of batch replacement values.
+ * @return A {@code Future} which returns the number of rows updated per statement.
+ * @throws SQLException if a database access error occurs
+ */
+ public Future<int[]> batch(final Connection conn, final String sql, final Object[][] params) throws SQLException {
+<span class="fc" id="L178"> return executorService.submit(new Callable<int[]>() {</span>
+
+ @Override
+ public int[] call() throws Exception {
+<span class="fc" id="L182"> return queryRunner.batch(conn, sql, params);</span>
+ }
+
+ });
+ }
+
+ /**
+ * Execute a batch of SQL INSERT, UPDATE, or DELETE queries. The
+ * {@code Connection} is retrieved from the {@code DataSource}
+ * set in the constructor. This {@code Connection} must be in
+ * auto-commit mode or the update will not be saved.
+ *
+ * @param sql The SQL to execute.
+ * @param params An array of query replacement parameters. Each row in
+ * this array is one set of batch replacement values.
+ * @return A {@code Future} which returns the number of rows updated per statement.
+ * @throws SQLException if a database access error occurs
+ */
+ public Future<int[]> batch(final String sql, final Object[][] params) throws SQLException {
+<span class="fc" id="L201"> return executorService.submit(new Callable<int[]>() {</span>
+
+ @Override
+ public int[] call() throws Exception {
+<span class="fc" id="L205"> return queryRunner.batch(sql, params);</span>
+ }
+
+ });
+ }
+
+ /**
+ * Class that encapsulates the continuation for query calls.
+ * @param <T> The type of the result from the call to handle.
+ */
+ protected class QueryCallableStatement<T> implements Callable<T> {
+ private final String sql;
+ private final Object[] params;
+ private final Connection conn;
+ private final boolean closeConn;
+ private final PreparedStatement ps;
+ private final ResultSetHandler<T> rsh;
+
+ /**
+ * Creates a new {@code QueryCallableStatement} instance.
+ *
+ * @param conn The connection to use for the batch call.
+ * @param closeConn True if the connection should be closed, false otherwise.
+ * @param ps The {@link PreparedStatement} to be executed.
+ * @param rsh The handler that converts the results into an object.
+ * @param sql The SQL statement to execute.
+ * @param params An array of query replacement parameters. Each row in
+ * this array is one set of batch replacement values.
+ */
+ public QueryCallableStatement(final Connection conn, final boolean closeConn, final PreparedStatement ps,
+<span class="nc" id="L235"> final ResultSetHandler<T> rsh, final String sql, final Object... params) {</span>
+<span class="nc" id="L236"> this.sql = sql;</span>
+<span class="nc" id="L237"> this.params = params;</span>
+<span class="nc" id="L238"> this.conn = conn;</span>
+<span class="nc" id="L239"> this.closeConn = closeConn;</span>
+<span class="nc" id="L240"> this.ps = ps;</span>
+<span class="nc" id="L241"> this.rsh = rsh;</span>
+<span class="nc" id="L242"> }</span>
+
+ /**
+ * The actual call to {@code handle()} method.
+ *
+ * @return an array of update counts containing one element for each command in the batch.
+ * @throws SQLException if a database access error occurs.
+ * @see ResultSetHandler#handle(ResultSet)
+ */
+ @Override
+ public T call() throws SQLException {
+<span class="nc" id="L253"> ResultSet rs = null;</span>
+<span class="nc" id="L254"> T ret = null;</span>
+
+ try {
+<span class="nc" id="L257"> rs = wrap(ps.executeQuery());</span>
+<span class="nc" id="L258"> ret = rsh.handle(rs);</span>
+<span class="nc" id="L259"> } catch (final SQLException e) {</span>
+<span class="nc" id="L260"> rethrow(e, sql, params);</span>
+ } finally {
+ try {
+<span class="nc" id="L263"> close(rs);</span>
+ } finally {
+<span class="nc" id="L265"> close(ps);</span>
+<span class="nc bnc" id="L266" title="All 2 branches missed."> if (closeConn) {</span>
+<span class="nc" id="L267"> close(conn);</span>
+ }
+ }
+ }
+
+<span class="nc" id="L272"> return ret;</span>
+ }
+
+ }
+
+ /**
+ * Execute an SQL SELECT query with replacement parameters. The
+ * caller is responsible for closing the connection.
+ * @param <T> The type of object that the handler returns
+ * @param conn The connection to execute the query in.
+ * @param sql The query to execute.
+ * @param rsh The handler that converts the results into an object.
+ * @param params The replacement parameters.
+ * @return A {@code Future} which returns the result of the query call.
+ * @throws SQLException if a database access error occurs
+ */
+ public <T> Future<T> query(final Connection conn, final String sql, final ResultSetHandler<T> rsh, final Object... params)
+ throws SQLException {
+<span class="fc" id="L290"> return executorService.submit(new Callable<T>() {</span>
+
+ @Override
+ public T call() throws Exception {
+<span class="fc" id="L294"> return queryRunner.query(conn, sql, rsh, params);</span>
+ }
+
+ });
+ }
+
+ /**
+ * Execute an SQL SELECT query without any replacement parameters. The
+ * caller is responsible for closing the connection.
+ * @param <T> The type of object that the handler returns
+ * @param conn The connection to execute the query in.
+ * @param sql The query to execute.
+ * @param rsh The handler that converts the results into an object.
+ * @return A {@code Future} which returns the result of the query call.
+ * @throws SQLException if a database access error occurs
+ */
+ public <T> Future<T> query(final Connection conn, final String sql, final ResultSetHandler<T> rsh) throws SQLException {
+<span class="fc" id="L311"> return executorService.submit(new Callable<T>() {</span>
+
+ @Override
+ public T call() throws Exception {
+<span class="fc" id="L315"> return queryRunner.query(conn, sql, rsh);</span>
+ }
+
+ });
+ }
+
+ /**
+ * Executes the given SELECT SQL query and returns a result object.
+ * The {@code Connection} is retrieved from the
+ * {@code DataSource} set in the constructor.
+ * @param <T> The type of object that the handler returns
+ * @param sql The SQL statement to execute.
+ * @param rsh The handler used to create the result object from
+ * the {@code ResultSet}.
+ * @param params Initialize the PreparedStatement's IN parameters with
+ * this array.
+ * @return A {@code Future} which returns the result of the query call.
+ * @throws SQLException if a database access error occurs
+ */
+ public <T> Future<T> query(final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
+<span class="fc" id="L335"> return executorService.submit(new Callable<T>() {</span>
+
+ @Override
+ public T call() throws Exception {
+<span class="fc" id="L339"> return queryRunner.query(sql, rsh, params);</span>
+ }
+
+ });
+ }
+
+ /**
+ * Executes the given SELECT SQL without any replacement parameters.
+ * The {@code Connection} is retrieved from the
+ * {@code DataSource} set in the constructor.
+ * @param <T> The type of object that the handler returns
+ * @param sql The SQL statement to execute.
+ * @param rsh The handler used to create the result object from
+ * the {@code ResultSet}.
+ *
+ * @return A {@code Future} which returns the result of the query call.
+ * @throws SQLException if a database access error occurs
+ */
+ public <T> Future<T> query(final String sql, final ResultSetHandler<T> rsh) throws SQLException {
+<span class="fc" id="L358"> return executorService.submit(new Callable<T>() {</span>
+
+ @Override
+ public T call() throws Exception {
+<span class="fc" id="L362"> return queryRunner.query(sql, rsh);</span>
+ }
+
+ });
+ }
+
+ /**
+ * @deprecated No longer used by this class. Will be removed in a future version.
+ * Class that encapsulates the continuation for update calls.
+ */
+ @Deprecated
+ protected class UpdateCallableStatement implements Callable<Integer> {
+ private final String sql;
+ private final Object[] params;
+ private final Connection conn;
+ private final boolean closeConn;
+ private final PreparedStatement ps;
+
+ /**
+ *
+ *
+ * @param conn The connection to use for the batch call.
+ * @param closeConn True if the connection should be closed, false otherwise.
+ * @param ps The {@link PreparedStatement} to be executed.
+ * @param sql The SQL statement to execute.
+ * @param params An array of query replacement parameters. Each row in
+ * this array is one set of batch replacement values.
+ */
+<span class="nc" id="L390"> public UpdateCallableStatement(final Connection conn, final boolean closeConn, final PreparedStatement ps, final String sql, final Object... params) {</span>
+<span class="nc" id="L391"> this.sql = sql;</span>
+<span class="nc" id="L392"> this.params = params;</span>
+<span class="nc" id="L393"> this.conn = conn;</span>
+<span class="nc" id="L394"> this.closeConn = closeConn;</span>
+<span class="nc" id="L395"> this.ps = ps;</span>
+<span class="nc" id="L396"> }</span>
+
+ /**
+ * The actual call to {@code executeUpdate()} method.
+ *
+ * @return either (1) the row count for SQL Data Manipulation Language (DML) statements or
+ * (2) 0 for SQL statements that return nothing
+ * @throws SQLException if a database access error occurs.
+ * @see PreparedStatement#executeUpdate()
+ */
+ @Override
+ public Integer call() throws SQLException {
+<span class="nc" id="L408"> int rows = 0;</span>
+
+ try {
+<span class="nc" id="L411"> rows = ps.executeUpdate();</span>
+<span class="nc" id="L412"> } catch (final SQLException e) {</span>
+<span class="nc" id="L413"> rethrow(e, sql, params);</span>
+ } finally {
+<span class="nc" id="L415"> close(ps);</span>
+<span class="nc bnc" id="L416" title="All 2 branches missed."> if (closeConn) {</span>
+<span class="nc" id="L417"> close(conn);</span>
+ }
+ }
+
+<span class="nc" id="L421"> return Integer.valueOf(rows);</span>
+ }
+
+ }
+
+ /**
+ * Execute an SQL INSERT, UPDATE, or DELETE query without replacement
+ * parameters.
+ *
+ * @param conn The connection to use to run the query.
+ * @param sql The SQL to execute.
+ * @return A {@code Future} which returns the number of rows updated.
+ * @throws SQLException if a database access error occurs
+ */
+ public Future<Integer> update(final Connection conn, final String sql) throws SQLException {
+<span class="fc" id="L436"> return executorService.submit(new Callable<Integer>() {</span>
+
+ @Override
+ public Integer call() throws Exception {
+<span class="fc" id="L440"> return Integer.valueOf(queryRunner.update(conn, sql));</span>
+ }
+
+ });
+ }
+
+ /**
+ * Execute an SQL INSERT, UPDATE, or DELETE query with a single replacement
+ * parameter.
+ *
+ * @param conn The connection to use to run the query.
+ * @param sql The SQL to execute.
+ * @param param The replacement parameter.
+ * @return A {@code Future} which returns the number of rows updated.
+ * @throws SQLException if a database access error occurs
+ */
+ public Future<Integer> update(final Connection conn, final String sql, final Object param) throws SQLException {
+<span class="fc" id="L457"> return executorService.submit(new Callable<Integer>() {</span>
+
+ @Override
+ public Integer call() throws Exception {
+<span class="fc" id="L461"> return Integer.valueOf(queryRunner.update(conn, sql, param));</span>
+ }
+
+ });
+ }
+
+ /**
+ * Execute an SQL INSERT, UPDATE, or DELETE query.
+ *
+ * @param conn The connection to use to run the query.
+ * @param sql The SQL to execute.
+ * @param params The query replacement parameters.
+ * @return A {@code Future} which returns the number of rows updated.
+ * @throws SQLException if a database access error occurs
+ */
+ public Future<Integer> update(final Connection conn, final String sql, final Object... params) throws SQLException {
+<span class="fc" id="L477"> return executorService.submit(new Callable<Integer>() {</span>
+
+ @Override
+ public Integer call() throws Exception {
+<span class="fc" id="L481"> return Integer.valueOf(queryRunner.update(conn, sql, params));</span>
+ }
+
+ });
+ }
+
+ /**
+ * Executes the given INSERT, UPDATE, or DELETE SQL statement without
+ * any replacement parameters. The {@code Connection} is retrieved
+ * from the {@code DataSource} set in the constructor. This
+ * {@code Connection} must be in auto-commit mode or the update will
+ * not be saved.
+ *
+ * @param sql The SQL statement to execute.
+ * @throws SQLException if a database access error occurs
+ * @return A {@code Future} which returns the number of rows updated.
+ */
+ public Future<Integer> update(final String sql) throws SQLException {
+<span class="fc" id="L499"> return executorService.submit(new Callable<Integer>() {</span>
+
+ @Override
+ public Integer call() throws Exception {
+<span class="fc" id="L503"> return Integer.valueOf(queryRunner.update(sql));</span>
+ }
+
+ });
+ }
+
+ /**
+ * Executes the given INSERT, UPDATE, or DELETE SQL statement with
+ * a single replacement parameter. The {@code Connection} is
+ * retrieved from the {@code DataSource} set in the constructor.
+ * This {@code Connection} must be in auto-commit mode or the
+ * update will not be saved.
+ *
+ * @param sql The SQL statement to execute.
+ * @param param The replacement parameter.
+ * @throws SQLException if a database access error occurs
+ * @return A {@code Future} which returns the number of rows updated.
+ */
+ public Future<Integer> update(final String sql, final Object param) throws SQLException {
+<span class="fc" id="L522"> return executorService.submit(new Callable<Integer>() {</span>
+
+ @Override
+ public Integer call() throws Exception {
+<span class="fc" id="L526"> return Integer.valueOf(queryRunner.update(sql, param));</span>
+ }
+
+ });
+ }
+
+ /**
+ * Executes the given INSERT, UPDATE, or DELETE SQL statement. The
+ * {@code Connection} is retrieved from the {@code DataSource}
+ * set in the constructor. This {@code Connection} must be in
+ * auto-commit mode or the update will not be saved.
+ *
+ * @param sql The SQL statement to execute.
+ * @param params Initializes the PreparedStatement's IN (i.e. '?')
+ * parameters.
+ * @throws SQLException if a database access error occurs
+ * @return A {@code Future} which returns the number of rows updated.
+ */
+ public Future<Integer> update(final String sql, final Object... params) throws SQLException {
+<span class="fc" id="L545"> return executorService.submit(new Callable<Integer>() {</span>
+
+ @Override
+ public Integer call() throws Exception {
+<span class="fc" id="L549"> return Integer.valueOf(queryRunner.update(sql, params));</span>
+ }
+
+ });
+ }
+
+ /**
+ * Executes {@link QueryRunner#insert(String, ResultSetHandler)} asynchronously.
+ *
+ * @param <T> Return type expected
+ * @param sql SQL insert statement to execute
+ * @param rsh {@link ResultSetHandler} for handling the results
+ * @return {@link Future} that executes a query runner insert
+ * @see QueryRunner#insert(String, ResultSetHandler)
+ * @throws SQLException if a database access error occurs
+ * @since 1.6
+ */
+ public <T> Future<T> insert(final String sql, final ResultSetHandler<T> rsh) throws SQLException {
+<span class="fc" id="L567"> return executorService.submit(new Callable<T>() {</span>
+
+ @Override
+ public T call() throws Exception {
+<span class="fc" id="L571"> return queryRunner.insert(sql, rsh);</span>
+ }
+
+ });
+ }
+
+ /**
+ * Executes {@link QueryRunner#insert(String, ResultSetHandler, Object...)} asynchronously.
+ *
+ * @param <T> Return type expected
+ * @param sql SQL insert statement to execute
+ * @param rsh {@link ResultSetHandler} for handling the results
+ * @param params Parameter values for substitution in the SQL statement
+ * @return {@link Future} that executes a query runner insert
+ * @see QueryRunner#insert(String, ResultSetHandler, Object...)
+ * @throws SQLException if a database access error occurs
+ * @since 1.6
+ */
+ public <T> Future<T> insert(final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
+<span class="fc" id="L590"> return executorService.submit(new Callable<T>() {</span>
+
+ @Override
+ public T call() throws Exception {
+<span class="fc" id="L594"> return queryRunner.insert(sql, rsh, params);</span>
+ }
+ });
+ }
+
+ /**
+ * Executes {@link QueryRunner#insert(Connection, String, ResultSetHandler)} asynchronously.
+ *
+ * @param <T> Return type expected
+ * @param conn {@link Connection} to use to execute the SQL statement
+ * @param sql SQL insert statement to execute
+ * @param rsh {@link ResultSetHandler} for handling the results
+ * @return {@link Future} that executes a query runner insert
+ * @see QueryRunner#insert(Connection, String, ResultSetHandler)
+ * @throws SQLException if a database access error occurs
+ * @since 1.6
+ */
+ public <T> Future<T> insert(final Connection conn, final String sql, final ResultSetHandler<T> rsh) throws SQLException {
+<span class="fc" id="L612"> return executorService.submit(new Callable<T>() {</span>
+
+ @Override
+ public T call() throws Exception {
+<span class="fc" id="L616"> return queryRunner.insert(conn, sql, rsh);</span>
+ }
+ });
+ }
+
+ /**
+ * Executes {@link QueryRunner#insert(Connection, String, ResultSetHandler, Object...)} asynchronously.
+ *
+ * @param <T> Return type expected
+ * @param conn {@link Connection} to use to execute the SQL statement
+ * @param sql SQL insert statement to execute
+ * @param rsh {@link ResultSetHandler} for handling the results
+ * @param params Parameter values for substitution in the SQL statement
+ * @return {@link Future} that executes a query runner insert
+ * @see QueryRunner#insert(Connection, String, ResultSetHandler, Object...)
+ * @throws SQLException if a database access error occurs
+ * @since 1.6
+ */
+ public <T> Future<T> insert(final Connection conn, final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
+<span class="fc" id="L635"> return executorService.submit(new Callable<T>() {</span>
+
+ @Override
+ public T call() throws Exception {
+<span class="fc" id="L639"> return queryRunner.insert(conn, sql, rsh, params);</span>
+ }
+ });
+ }
+
+ /**
+ * {@link QueryRunner#insertBatch(String, ResultSetHandler, Object[][])} asynchronously.
+ *
+ * @param <T> Return type expected
+ * @param sql SQL insert statement to execute
+ * @param rsh {@link ResultSetHandler} for handling the results
+ * @param params An array of query replacement parameters. Each row in
+ * this array is one set of batch replacement values.
+ * @return {@link Future} that executes a query runner batch insert
+ * @see QueryRunner#insertBatch(String, ResultSetHandler, Object[][])
+ * @throws SQLException if a database access error occurs
+ * @since 1.6
+ */
+ public <T> Future<T> insertBatch(final String sql, final ResultSetHandler<T> rsh, final Object[][] params) throws SQLException {
+<span class="nc" id="L658"> return executorService.submit(new Callable<T>() {</span>
+
+ @Override
+ public T call() throws Exception {
+<span class="nc" id="L662"> return queryRunner.insertBatch(sql, rsh, params);</span>
+ }
+ });
+ }
+
+ /**
+ * {@link QueryRunner#insertBatch(Connection, String, ResultSetHandler, Object[][])} asynchronously.
+ *
+ * @param <T> Return type expected
+ * @param conn {@link Connection} to use to execute the SQL statement
+ * @param sql SQL insert statement to execute
+ * @param rsh {@link ResultSetHandler} for handling the results
+ * @param params An array of query replacement parameters. Each row in
+ * this array is one set of batch replacement values.
+ * @return {@link Future} that executes a query runner batch insert
+ * @see QueryRunner#insertBatch(Connection, String, ResultSetHandler, Object[][])
+ * @throws SQLException if a database access error occurs
+ * @since 1.6
+ */
+ public <T> Future<T> insertBatch(final Connection conn, final String sql, final ResultSetHandler<T> rsh, final Object[][] params) throws SQLException {
+<span class="nc" id="L682"> return executorService.submit(new Callable<T>() {</span>
+
+ @Override
+ public T call() throws Exception {
+<span class="nc" id="L686"> return queryRunner.insertBatch(conn, sql, rsh, params);</span>
+ }
+ });
+ }
+
+}
+</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.5.201910111838</span></div></body></html>
\ No newline at end of file
Added: dev/commons/dbutils/1.8-RC2/site/jacoco/org.apache.commons.dbutils/BaseResultSetHandler.html
==============================================================================
--- dev/commons/dbutils/1.8-RC2/site/jacoco/org.apache.commons.dbutils/BaseResultSetHandler.html (added)
+++ dev/commons/dbutils/1.8-RC2/site/jacoco/org.apache.commons.dbutils/BaseResultSetHandler.html Wed Jan 8 06:02:46 2020
@@ -0,0 +1 @@
[... 3 lines stripped ...]