Quantcast
Channel: Planet Apache
Viewing all articles
Browse latest Browse all 9364

Simone Tripodi: ... and then, Async Apache Commons DbUtils

$
0
0
Time ago a Commons user, William Speirs, submitted an interesting patch for Apache Commons DbUtils adding asynchronous JDBC calls, that involuntarily contributed to add that kind of feature to Apache Commons Digester.

The minor improvement that IMHO we could do is, instead of returning Callable<?> instances, we could return directly Future<?>, managing ExecutorService directly inside the new class.

Et voilà, next Commons DbUtils release will contains that new feature and users will be able to run JDBC calls in separate threads:

DataSource dataSource = XXX;
AsyncQueryRunner runner = new AsyncQueryRunner( dataSource, Executors.newFixedThreadPool( 10 ) );
...
Future future = runner.update( "UPDATE table_name SET column1=?", param );


Stay tuned for next Commons DbUtils because we are going to submit a RC soon!

Viewing all articles
Browse latest Browse all 9364

Trending Articles