How to use the Guava ListenableFuture and the Futures.chain() methods

后端 未结 3 1170
南方客
南方客 2021-01-13 22:10

I have a homework task that requires me to learn how to use the Guava concurrency library.

In the task I have several thread pools, where each one is controlled by a

3条回答
  •  一生所求
    2021-01-13 23:11

    As Louis mentions, I think that Futures.allAsList etc. could be useful for you. However, I think that Futures.chain does seem useful and appropriate for the situation you describe. Since this is an assignment meant to challenge you, I'm not going to say any more than this: Futures.chain allows you to submit a task for execution upon completion of another task, and it returns a new ListenableFuture representing the result of that task. How does that apply to what you're trying to do?

提交回复
热议问题