title: Tomcat 7 servlet needs to force a close of a long-lasting NIO connection
body: <p>I have a Tomcat 7 servlet accepting connections from remote clients, and keeping those connections open for hours or days if possible. So, we are using the NIO connector.
  The bandwidth on the physical connections may be expensive, so traffic is to be kept to an absolute minimum, therefore we have programmed the remote clients to test the connection with a very infrequent ping.</p>
  
  <p>Occasionally, the servlet is told the connection is closed, but it seems that the remote clients are not told. The clients don't find out until they do a ping, at which time they can establish a new connection. We need to reduce the length of time the clients are not connected, without using more pings.</p>
  
  <p>One way that works is to shut down the Tomcat server. The clients know they are disconnected immediately. Obviously we don't want to be shutting down Tomcat - my point is there must be some kind of signal making it across the normally-quiet connection.</p>
  
  <p>How can I force Tomcat to send this signal? Please don't respond that I can't unless you can tell me why, with specifics, partly because I can't believe it, and mostly because I don't want to believe it. It seems strange - like not being able to hang-up the phone on someone.</p>
  
  <p>Alternate question #1 - can a servlet recover a connection it has been told is closed?</p>
  
  <p>Alternate question #2 - can anyone think of anything else that might help?</p>