🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java
Article #552

Re: UNIX like select() for Java!

#552
From: Robert Kroes
Date: Thu, 18 Dec 1997 00:00
30 lines
2603 bytes


Eric Hodges wrote:

> Mark Frazier wrote:
> >
> > > The xware.net.Selector class provides an event-driven mechanism for
> > > handling input from
> > > multiple sockets. It is ideal for writing server like Java applets or
> > > applications. It can be used
> > > on both the client or server side of your sockets based interface.
> >
> > Thanks for this.
> >
> > However, isn't more "java like" to take the approach of
> > running every socket in a new thread? I've done this in
> > Java servers. You start up a Java server socket, and everytime
> > you get a connection, you run a new thread which is a class
> > that serves only that socket. The code is pretty trivial.
>
> Yeah, I'm not sure why anyone would want to go back to select().  That
> always seemed like a hack to deal with asynchronous notification in a
> single threaded environment.

I would like to "third" that motion if I may :-) I've had great success with
the multiple thread approach and personally find it a more elegant
solution... Threads are so easy to use in Java. All reads block anyway so
there really isn't any overhead. When there _is_ activity the workload is
divided up nicely according to thread priority.
Technical Details
Message-ID: <349901FB.50422B7D@labyrinth.net.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <34973C27.759E1BA4@bellatlantic.net> <34984761.369C83CC@rmi.net> <34985E4D.539C@telecheck.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10a146,aee69011bb9ffa08
X-Google-Attributes: gid10a146,public
X-Google-Thread: 111d6b,aee69011bb9ffa08
X-Google-Attributes: gid111d6b,public
X-Google-Thread: 1291f0,aee69011bb9ffa08
X-Google-Attributes: gid1291f0,public
X-Google-Thread: f5d71,aee69011bb9ffa08
X-Google-Attributes: gidf5d71,public
X-Google-Thread: 107d55,aee69011bb9ffa08
X-Google-Attributes: gid107d55,public
X-Google-Thread: 1089d0,aee69011bb9ffa08
X-Google-Attributes: gid1089d0,public
X-Google-Thread: f4bc9,aee69011bb9ffa08
X-Google-Attributes: gidf4bc9,public
X-Google-Thread: 112e38,aee69011bb9ffa08
X-Google-Attributes: gid112e38,public
From: Robert Kroes <rk@labyrinth.net.au>
Subject: Re: UNIX like select() for Java!
Date: 1997/12/18
Message-ID: <349901FB.50422B7D@labyrinth.net.au>
X-Deja-AN: 299306338
Content-Transfer-Encoding: 7bit
References: <34973C27.759E1BA4@bellatlantic.net> <34984761.369C83CC@rmi.net> <34985E4D.539C@telecheck.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Organization: Labyrinth Connections Pty Ltd
Newsgroups: comp.lang.java,comp.lang.java.misc,comp.lang.java.programmer,comp.lang.java.tech,borland.public.jbuilder.thirdpartytools,borland.public.jbuilder.java.api,symantec.support.devtools.pc.visual-cafe-pro.using,symantec.support.devtools.windows.vcafe4java.Other