Created
January 8, 2014 22:46
-
-
Save wspeirs/8326003 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AsyncExecutor asyncRun = new AsyncExecutor(Executors.newFixedThreadPool(5)); | |
try | |
{ | |
// 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) | |
try | |
{ | |
// 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