Kill or interrupt threads when a client closes a connection

I am using jetty-9 built in for a proxy application (netflix zuul hosting). Unfortunately, some of the services underlying the proxy have very long (as within one hour) timeouts. Most customers do not wait about an hour. However, since the console server stream is blocked, waiting for input from a remote server (the server we are proxing), the stream has no way to act on this information.

Is there a way to interrupt or kill the berth server thread when the client that called it closes its connection. Basically, if the socket from the client is closed, I want to interrupt this stream. Alternatively, if I knew the stream, I could match this with the outgoing socket and close it, thereby waking the stream.

I thought that if I could get a list of sockets, I could query them (?) To see if they are still alive? But how to deploy a jetty into the guts of the engine to get a list of sockets, not to mention mapping a socket for an inkjet thread?

+4
source share

Source: https://habr.com/ru/post/1612873/


All Articles