On Sat, Apr 23, 2011 at 11:28 PM, Ken Wesson <kwess...@gmail.com> wrote: > On Sat, Apr 23, 2011 at 11:26 PM, Alan <a...@malloys.org> wrote: >> On Apr 23, 4:41 pm, Ken Wesson <kwess...@gmail.com> wrote: >>> On Sat, Apr 23, 2011 at 5:30 PM, Michael Wood <esiot...@gmail.com> wrote: >>> > On 23 April 2011 17:31, Ken Wesson <kwess...@gmail.com> wrote: >>> >> On Sat, Apr 23, 2011 at 5:12 AM, Zlatko Josic <zlatko.jo...@gmail.com> >>> >> wrote: >>> >>> Hi, >>> >>> I would like to start two progams from Eclipse. One is a server and the >>> >>> other one is a client. >>> >>> I use Load Clojure file in REPL from Eclipse menu. When I start the >>> >>> server >>> >>> it never ends because >>> >>> the server has endless loop where it waits for clients. Now when I >>> >>> start the >>> >>> client programs it never >>> >>> evaluates because REPL is busy with server program. I suppose it works >>> >>> as I >>> >>> described. Maybe I am >>> >>> wrong I am not sure. >>> >>> Any ideas to overcame this situation are welcome. >>> >>> >> Have the server spawning function (or both, if the client is GUI) just >>> >> start a separate thread and immediately return. >>> >>> >> (In fact, servers normally are multithreaded anyway, aren't they, to >>> >> be able to handle multiple concurrent incoming requests.) >>> >>> > Well, Java servers probably are yes, but traditional Unix servers >>> > would normally fork a new process for each incoming connection. >>> >>> Poor man's threads. Although the insulation of each one against >>> crashes in the others might be useful when you're coding in a language >>> with memory management tools as primitive as C's. ;) >>> >>> > There are various ways of doing it. A separate process per client >>> > connection; a separate thread per client connection; a single >>> > process/thread handling multiple clients with select()/poll()/etc. >>> >>> For the first one, the JVM startup time is prohibitive; for the third >>> you need nonblocking socket I/O, which might be in Java 7 or something >>> but isn't available to us JVM-6 users. >> >> http://download.oracle.com/javase/1.5.0/docs/api/java/nio/channels/package-summary.html#multiplex >> >> Non-blocking socket IO has been around since 1.5, maybe even 1.4. > > Oh? Then why was there a recent thread here about how it's finally > made it into Java 7 via JSR something-or-other?
It was JSR 203 and the thread was "agent action queueing is asynchronous?". André Caron said: > Basically, I can't block on "Selector.select()", so I have to poll. > Can't wait for JSR203 (http://www.jcp.org/en/jsr/detail?id=203) to be > approved as part of Java 7. The implication is clear: you can select on a socket, which blocks, or you can do some sort of busy-loop polling, but there is no nonblocking callback-based socket API pre-JSR203, and JSR203 certainly wasn't in Java back in 1.5, let alone 1.4. If that information is incorrect I suggest you take it up with André. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en