-
Notifications
You must be signed in to change notification settings - Fork 10
Conversation
} catch (Exception e) { | ||
handler.handle(Future.failedFuture(e)); | ||
} | ||
vertx.executeBlocking( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this - isn't the whole point of a future listener that it's not called until the result is ready? So why use executeBlocking for the get()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to execute the callback in vertx threads
On 07 ott 2015, at 12:04, Tim Fox notifications@github.com wrote:
In src/main/java/io/vertx/java/spi/cluster/impl/jgroups/services/DefaultRpcExecutorService.java:
@@ -80,13 +79,16 @@ public DefaultRpcExecutorService(RpcDispatcher dispatcher) {
try {
NotifyingFuture<RspList> notifyingFuture = this.execute(action, options);
notifyingFuture.setListener((future) -> {
try {
RspList<T> rspList = future.get();
T result = futureDone(rspList);
handler.handle(Future.succeededFuture(result));
} catch (Exception e) {
handler.handle(Future.failedFuture(e));
}
I don't understand this - isn't the whole point of a future listener that it's not called until the result is ready? So why use executeBlocking for the get()?vertx.executeBlocking(
—
Reply to this email directly or view it on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can change that with runOnContext.
what do you think?
On 07 ott 2015, at 12:04, Tim Fox notifications@github.com wrote:
In src/main/java/io/vertx/java/spi/cluster/impl/jgroups/services/DefaultRpcExecutorService.java:
@@ -80,13 +79,16 @@ public DefaultRpcExecutorService(RpcDispatcher dispatcher) {
try {
NotifyingFuture<RspList> notifyingFuture = this.execute(action, options);
notifyingFuture.setListener((future) -> {
try {
RspList<T> rspList = future.get();
T result = futureDone(rspList);
handler.handle(Future.succeededFuture(result));
} catch (Exception e) {
handler.handle(Future.failedFuture(e));
}
I don't understand this - isn't the whole point of a future listener that it's not called until the result is ready? So why use executeBlocking for the get()?vertx.executeBlocking(
—
Reply to this email directly or view it on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To execute a callback on the correct thread you should use context.runOnContext(). executeBlocking is for running blocking code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I'll change that asap.
Fabio - you should go and enjoy your holiday :) There is no rush to fix this today! |
…o vertx_thread_model
Now it's possible to execute tests with check threads on