Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Preventing queuing of requests when all connections exhausted

Hi,

On Tue, Feb 10, 2015 at 11:49 PM, John Gardiner Myers
<jgmyers@xxxxxxxxxxxxxx> wrote:
> On 2/6/2015 3:33 PM, Simone Bordet wrote:
>>
>> I pushed a couple of changes that I think would allow you to obtain the
>> behavior your want. Override HttpDestination.enqueue() and
>> HttpDestination.newExchangeQueue(). Mind to try and report back if you can
>> achieve what you want ?
>
>
> Let me see if I've figured out what you're thinking:
>
> I'd override HttpDestination.newExchangeQueue() to return an object that
> keeps an outstanding request count. That returned object would override
> Queue.offer() to fail if the count is too high, increment the count, and
> decorate the HttpExchange so that HttpExchange.getResponseListeners()
> returns an extra completion listener to decrement the count.

Creative ! :)
But no.

> I don't see why it would be necessary to override HttpDestination.enqueue().

You override newExchangeQueue() to provide a Queue with additional room.
Then you override enqueue() to return true/false depending on whether
you have enqueued or you want to reject enqueuing.

Overriding enqueue() only won't be enough for your case, since the
queue created by default is bounded at qx, while you need room for at
least qx+cx.

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
http://intalio.com
Developer advice, training, services and support
from the Jetty & CometD experts.
Intalio, the modern way to build business applications.


Back to the top