scala.concurrent.Future wrapper for java.util.concurrent.Future

前端 未结 4 1763
执念已碎
执念已碎 2020-12-06 04:36

I\'m using Play Framework 2.1.1 with an external java library that produces a java.util.concurrent.Future result. I\'m using the scala future\'s as opposed to Akka which I t

4条回答
  •  独厮守ぢ
    2020-12-06 05:14

    Future {
      blocking {
        jfuture.get
      }
    }
    

    This lets the ExecutionContext know that what you are doing is going to block, giving it a chance to allocate more threads. If you do not include blocking { } then you may run out of threads.

提交回复
热议问题