Once shutdownOutput() has been done, the connection will still need to be
fillInterested to seek the close from the other end, thus it's idle timeout
will still apply.  So either the close will arrive from the other end, or
idletimeout happens and then you should just close the endpoint.


On Tue, 25 May 2021 at 02:09, Josh Spiegel <joshlak...@gmail.com> wrote:

> Thanks for the response Greg.  After writing the response and calling
> shutdownOutput(), how do I set a forceful close timeout?
>
> Thanks,
> Josh
>
> On Thu, May 20, 2021 at 3:09 PM Greg Wilkins <gr...@webtide.com> wrote:
>
>> There is nothing preventing you accepting a connection and then
>> immediately sending an error response assuming a request is coming, and
>> half closing the connection. You can then give it a Connection class that
>> just consumes any characters received up to a low limit or short timeout.
>>
>>
>>
>> On Fri, 21 May 2021, 05:02 Josh Spiegel, <joshlak...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I'm using Jetty with a custom Connection/ConnectionFactory.
>>>
>>> I want to impose a connection limit and I don't want to abruptly close
>>> the connection without providing an error to the client.  Rather, I'd like
>>> to send an error message and then close the connection.  But I can't send
>>> the error response until I have received the first request.  I don't have
>>> control over when the client sends the first request but it would typically
>>> be shortly after the connection is established.
>>>
>>> What is the best way to do this?
>>>
>>> One idea I have is:
>>> (1) when the connection is created, schedule a task that will come back
>>> and close it within some short period (a few seconds)
>>> (2) if within that period, I get a request, send the error and then
>>> close the connection on the endPoint() write callback.
>>>
>>> Thanks,
>>> Josh
>>>
>>>
>>>
>>> _______________________________________________
>>> jetty-users mailing list
>>> jetty-users@eclipse.org
>>> To unsubscribe from this list, visit
>>> https://www.eclipse.org/mailman/listinfo/jetty-users
>>>
>> _______________________________________________
>> jetty-users mailing list
>> jetty-users@eclipse.org
>> To unsubscribe from this list, visit
>> https://www.eclipse.org/mailman/listinfo/jetty-users
>>
> _______________________________________________
> jetty-users mailing list
> jetty-users@eclipse.org
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/jetty-users
>


-- 
Greg Wilkins <gr...@webtide.com> CTO http://webtide.com
_______________________________________________
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users

Reply via email to