Skip to content

Instantly share code, notes, and snippets.

Created January 8, 2014 22:46
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
AsyncExecutor asyncRun = new AsyncExecutor(Executors.newFixedThreadPool(5));
// Setup the UpdateExecutor
UpdateExecutor executor = runner.update("UPDATE Person SET height=:height WHERE name=:name")
.bind(":height", 2.05)
.bind("name", "John Doe");
// Returns a Future for the update call
Future<Integer> callable = asyncRun.execute(executor);
} catch(SQLException sqle) {
// Handle it
// Sometime later (or in another thread)
// Get the result of the update
Integer updates = callable.get();
} catch(InterruptedException ie) {
// Handle it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment