Skip to content

Instantly share code, notes, and snippets.

@slaykovsky
Created February 13, 2017 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slaykovsky/f0550dafa7312af85ebe2b048f219d4e to your computer and use it in GitHub Desktop.
Save slaykovsky/f0550dafa7312af85ebe2b048f219d4e to your computer and use it in GitHub Desktop.
router.route("/api/testRuns*").handler(ctx -> client.getConnection(res -> {
if (res.failed()) {
ctx.fail(res.cause());
} else {
SQLConnection conn = res.result();
ctx.put("conn", conn);
ctx.addHeadersEndHandler(done -> conn.close(close -> {
}));
ctx.next();
}
})).failureHandler(ctx -> {
SQLConnection conn = ctx.get("conn");
if (conn != null) {
conn.close(close -> {
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment