Skip to content

Instantly share code, notes, and snippets.

@purplefox
Created February 18, 2014 14:05
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save purplefox/9071594 to your computer and use it in GitHub Desktop.
Save purplefox/9071594 to your computer and use it in GitHub Desktop.
final Context ctx = vertx.currentContext();
otherLibrary.doSomethingAsync("foo", new Runnable() {
public void run() {
// This will be executed on the other library's thread so we need to make sure the result is done on the correct context
ctx.runOnContext(new Handler<Void>() {
public void handle(Void v) {
// Now we are on the right context - use the Vert.x API as normal
request.response().end("blah");
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment