How can I make A future of future into one future object?

前端 未结 3 1834
再見小時候
再見小時候 2020-12-14 08:16

Env: Akka 2.1, scala version 2.10.M6, JDK 1.7,u5

Now is my problem: I have:

future1 = Futures.future(new Callable>(){...         


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-14 08:50

    You can create another task

    Futures.future(new Runnable(){
         // wait for future1
         // wait for future2
         // do something with the results.
    });
    

    or merge the tasks

    Futures.future(new Runnable(){
         // do the work future2 would have done.
         // wait for future1
         // do something with the results.
    });
    

提交回复
热议问题