Giter VIP home page Giter VIP logo

Comments (2)

anuraaga avatar anuraaga commented on May 22, 2024

Armeria is designed to be completely compatible with the official Apache Thrift library, including the generated code for services, so that you can drop it in as-is to an existing thrift server / stubs artifact. We agree, though, that the thrift generated code is not really ideal in many aspects, and would like to at some point tweak the thrift compiler to generate more modern Java code. But as you can imagine, this is not a trivial task.

In the meantime, it's usually not so difficult converting between futures, other futures, and even callbacks and hopefully doesn't cause too much stress. Perhaps we could consider adding an adapter between CompletableFuture and AsyncMethodCallback at least though since it's in the JDK.

class FutureUtils {
  public static void setFutureResult(CompletableFuture<T> future, AsyncMethodCallback handler) {
    future.whenComplete((result, throwable) -> {
      if (throwable != null) {
        handler.onError(throwable instanceof Exception ? (Exception) throwable : new ExecutionException(throwable);
      } else {
        handler.onComplete(result);
      }
    }
  }

Though I'm not sure if it's all that useful.

from armeria.

trustin avatar trustin commented on May 22, 2024

Filed a new issue: #113

from armeria.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.