Java pattern for nested callbacks?

后端 未结 4 681
滥情空心
滥情空心 2020-12-12 19:30

I\'m looking for a Java pattern for making a nested sequence of non-blocking method calls. In my case, some client code needs to asynchronously invoke a service to perform s

4条回答
  •  感情败类
    2020-12-12 19:40

    You can use actor computing model. In your case, the client, services, and callbacks [B-D] all can be represented as actors.

    There are many actor libraries for java. Most of them, however, are heavyweight, so I wrote a compact and extendable one: df4j. It considers actor model as a specific case of more general dataflow computing model and, as a result, allows user to create new types of actors, to optimally fit user's requirements.

提交回复
热议问题