Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

wrapped in vertx thread model #16

Merged
merged 8 commits into from
Dec 9, 2015
Merged

wrapped in vertx thread model #16

merged 8 commits into from
Dec 9, 2015

Conversation

fmarinelli
Copy link
Contributor

Now it's possible to execute tests with check threads on

} catch (Exception e) {
handler.handle(Future.failedFuture(e));
}
vertx.executeBlocking(
Copy link
Contributor

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()?

Copy link
Contributor Author

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));
    
  •    }
    
  •    vertx.executeBlocking(
    
    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()?


Reply to this email directly or view it on GitHub.

Copy link
Contributor Author

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));
    
  •    }
    
  •    vertx.executeBlocking(
    
    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()?


Reply to this email directly or view it on GitHub.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@purplefox
Copy link
Contributor

Fabio - you should go and enjoy your holiday :)

There is no rush to fix this today!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants