On 21/05/2012 18:30, Costin Manolache wrote: > On Mon, May 21, 2012 at 9:29 AM, Mark Thomas <ma...@apache.org> wrote: > >> On 21/05/2012 15:26, Costin Manolache wrote: >>> My understanding is that the timeout is implemented in poll.c maintain() >> - >>> by scanning the socket list in C. >>> >>> Why not doing the same thing in java - i.e. don't touch native code, have >>> all sockets 'long', and close whenever you need from java ? >> >> The timeout is also used in poll so it wouldn't be a completely clean >> solution. > > > How is it used in poll ? The poll can be arbitrary - there is no need to > guarantee that sockets timeout at the exact moment, it can happen later. > If poll time is 1/2 hour - than if no event happens you'll check every 1/2 > hour which sockets are expired.
It is used to ensure that the poll does not last beyond the next expected time out. While I agree time out can happen later, the current API isn't written that way and I not happy changing something like that in a point release. > The benefit of doing it in java is that you have more control - and may use > more advanced structures ( C is just a loop over the list of sockets, > wouldn't scale very well to 100K+ sockets - which are probably normal case > for websocket ). In the WebSocket case, the time out will be in Java. I just need the ability to set it to infinite without creating yet another PollSet. While I currently think per socket timeout is the way to go (it will simplify the current APR/native Poller code) I'm not wedded to the idea. If this doesn't work, I'm happy to look at alternatives. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org