Enumerator / Iteratee应用程序永远不会完成

时间:2013-12-13 15:10:35

标签: scala playframework enumerator iterate

当我从here尝试以下' Hello World' 示例时,应用程序永远不会停止。它是Iteratee,等待更多的输入吗?我试着像

这样的东西
val enumerator = Enumerator(1, 234, 455, 987).andThen(Enumerator.enumInput(Input.EOF))

但它没有帮助。

在Iteratee完成Enumerator中的所有元素后,我该怎么办才能停止应用程序?

import scala.concurrent.Future
import play.api.libs.iteratee._
import scala.concurrent.ExecutionContext.Implicits.global

object Experiment 
{       
  def main(args: Array[String]) 
  {
     val enumerator = Enumerator(1, 234, 455, 987)
     enumerator(Iteratee.foreach( println _ ))

     // same result with apply   
     //enumerator.apply(Iteratee.foreach( println _ ))

     println("Main is done pretty soon but the application will never stop.")
   }
}

0 个答案:

没有答案