From: Chris H. <ch...@ha...> - 2004-06-23 15:14:44
|
X is set by calling setMaxThreads() on your SocketListener instance. Let Y be the maximum queue size you want, such that X+Y concurrent messages will all get processed. Beyond X+Y, requests will be discarded. The ServerSocket has a 'backlog' queue in the Operating System's IO buffers, which holds inbound requests if no thread is available. By default Jetty sets this (Y) to X+1 if X > 0, and to 50 otherwise. If you need a different ServerSocket backlog queue size, you will have to extend the SocketListener class by providing a new implementation of newServerSocket(address, acceptQueueSize) - and substitute your own choice of acceptQueueSize (i.e. Y). If the default of Y=50 is acceptable, you may be able to get away with no coding by doing something like setMaxThreads(0); open(); setMaxThreads(X); or its XML equivalent. The backlog queue size is computed just once, during the open() call. Chris ----- Original Message ----- From: "Thorbjørn Ravn Andersen" <nospam0000@c.dk> To: <jet...@li...> Sent: Wednesday, June 23, 2004 1:49 PM Subject: [Jetty-support] How can I have at most X current instances of a given servlet, and let the X+1 ... X+n wait until there is a vacant slot? > I have a small Cocoon application running with the enclosed Jetty > 2.4.19, where I submit an XSL-FO file, and get a rendered version back, > where I now - due to the unpredictable resource usage by FOP and our > prints being of different sizes - would like to ensure that I have at > most X instances running at one time, and then making the rest wait > until one of the currently active is finished. > > I have looked at the Jetty docs, but I do not think that such a facility > is named something that I might look for. Is there a kind person who > can let me know where I need to look now? > > Best regards, > -- > > Thorbjoern Ravn Andersen "...plus...Tubular Bells!" > |