Giter Club home page Giter Club logo

Comments (4)

ohpauleez avatar ohpauleez commented on June 29, 2024

This is expected behavior. Interceptors always execute in order, and the contract of an Interceptor is that it takes and returns a Context. Async interceptors are migrated off of the HTTP request handling thread-pool to an async-pool until they are complete. That is, they complete asynchronously with respect to the request pool. This notion of async handling comes from the Servlet spec and matches the pattern seen in most Java Web Handlers (eg: Jetty).

You can dispatch other Futures/threads on other thread-pools and store their handles within the Context to achieve a non-blocking interceptor. If you do this, you will first want to "go async" since eventually an interceptor will await the results of dispatch.

I hope this helps clarify things

from pedestal.

mtsbarbosa avatar mtsbarbosa commented on June 29, 2024

@ohpauleez that makes sense now, thanks a lot!
But to be honest it is easy to get confused. Do you think a slight improvement for async interceptor docs makes sense?

from pedestal.

ohpauleez avatar ohpauleez commented on June 29, 2024

I'm always happy to help and I'm glad that all made sense!
Updates to the docs and additional clarification is always helpful for the project and the community. It's one of the best ways to contribute and help improve the project.

from pedestal.

hlship avatar hlship commented on June 29, 2024

I've made documentation improvements to more explicitly describe what async behavior is about, and the pitfalls therein.

from pedestal.

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.