On Tue, Nov 17, 2009 at 11:04 AM, braver <[email protected]> wrote:
> So what would be the scenario where you have two actors, one, the > reader, reading stdin, and sending to the other, the writer, which > then processes it line by line and writes stats? They're now started > in the main driver with start(), the reader, upon EOF, sends a special > EXIT message to the writer, then exits itself; the writer exits upon > receiving the EXIT, then the main thread exits too. The writer send a > "gimme" message to the reader every time it's ready to process, and > the reader send a line to writer then. If it has no line, it sends > EXIT. > Neither Lift Actors nor Scala Actors are meant for blocking IO. So, reading in an Actor is just going to be pain. You're a lot better off using a thread for reading and a separate thread for writing. A writing thread should never ask for input... the input should always be put in a queue and consumed by the thread doing the writing. > I can create the Lift actors for reader and writer, and then they will > start themselves to work forever. How would I recreate the above > semantics to shut down on EOF? > There's no such thing as "shut down" for Lift Actors. They are like any other object in your JVM. They respond to messages and when there are no more references to them, they get garbage collected. > > Cheers, > Alexy > > -- > > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<liftweb%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=. > > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
