Skip to content

Instead of Java Vertx Futures, hand over Promises #26

Open
@Narigo

Description

@Narigo

This would enable us to write:

def start(p: Promise[Unit]) = {
  doSomethingAsyncReturningAFuture() map { result =>
    p.success()
  } recover { ex =>
    logger.error("problem at start up!", ex)
    p.failure()
  }
}

a) We wouldn't need the Future class at all.
b) It would be more towards the Scala-way
c) Users cannot overwrite the Futures failure handler during startup. This is safer than the Java API approach (hoping the dev doesn't do stupid things ;)).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions