Scala I/O processor

72 views
Skip to first unread message

Daniel Sobral

unread,
Sep 3, 2012, 5:12:12 PM9/3/12
to scala-i...@googlegroups.com
There's something I don't quite get about processors... I have an
output I need to do asynchronously. It's just a fire&forget thing, but
it's called from on asynchronous handlers from netty, so I can't
block.

Now, the question I have is... does execute() block? If so, how can I
accomplish the above?

--
Daniel C. Sobral

I travel to the future all the time.

Jesse Eichar

unread,
Sep 5, 2012, 3:00:26 PM9/5/12
to scala-i...@googlegroups.com
If you want asynchronous behaviour with a processor you need to call future or futureExec.  

Now for the execute() method.  It will recursively force execute all processors.  Suppose your process is a Processor[LongTraversable[Processor[Int]]].  For all the IO to happen all Processors need to be executed.  Execute takes care of that.  This is a possibly a special case but one I encountered while writing tests.   

Naturally the futureExec() does the same thing but asynchronously.  

Jesse

Daniel Sobral

unread,
Sep 5, 2012, 11:39:08 PM9/5/12
to scala-i...@googlegroups.com
I see, thanks. As a feedback, that is not clear from the Scala I/O
docs on asynchronous I/O. Also, the emphasis there is on the read most
of the time, which made it harder to figure out write.

Jesse Eichar

unread,
Sep 10, 2012, 3:14:31 AM9/10/12
to scala-i...@googlegroups.com
Fair points.   I will play around with the idea of how to show the writing process a bit more prominently.

Jesse
Reply all
Reply to author
Forward
0 new messages