Continuations in Java

前端 未结 11 2011
再見小時候
再見小時候 2020-12-05 00:20

Is there a good implementation of continuations in Java?

If so, what is the overhead like? The JVM wasn\'t designed with these sort of things in mind, right? So is t

11条回答
  •  余生分开走
    2020-12-05 01:05

    Another strong competitior has appeared recently.

    Quasar uses forked from Matthias Mann's implementation of java continuations to provide higher level features like lightweight threads, Erlang-like actors and Go-like coroutines and channels.

    There are many benchmarks and detailed introductions in the Quasar Blog.

    There is also ready-to-use integration named Comsat aimed to help easily building performant web services based on continuations machinery under the hood.

    Quasar also provides a nice Kotlin API that was featured on recent JetBrains webinar Quasar: Efficient and Elegant Fibers, Channels and Actors.

    Everything mentioned is open-source and free to use.

    See also http://blog.paralleluniverse.co/2015/08/07/scoped-continuations/


    Update

    Quasar's experience was later used as foundation for the Loom Project which aims to bring continuations support directly into JVM sometime past Java 11.

    It's under active development now and already has a working alpha prototype.

提交回复
热议问题