Akka组成不同类型的期货

我有3个不同类型的scala.concurrent.Future,需要在akka.dispatch.Futures.sequence中组合它们,以便在所有期货完成时得到通知,期货声明为:

Future<List<Request>> f1
Future<List<Offer>> f2
Future<Event> f3

我尝试将它们放在一个声明为Iterable<Future<Object>> futureIterable = new ArrayList<>();Iterable<Future<Object>>

如下所示:

    Iterable<Future<Object>> futureIterable = new ArrayList<>();
    Future<Iterable<Future<Object>>> futureListOfInts=sequence(futureIterable,getContext().dispatcher());

我收到了这样的编译消息:

Error:(139, 67) java: incompatible types: inferred type does not conform to equality constraint(s)
inferred: scala.concurrent.Future<java.lang.Object>
equality constraints(s): scala.concurrent.Future<java.lang.Object>,java.lang.Object

转载请注明出处:http://www.fulida88.com/article/20230526/2339198.html