title: How do I limit the number of connections Jetty will accept?
body: <p>I'm running Jetty 7.2.2 and want to limit the number of connections it will handle, such that when it reaches a limit (eg 5000), it will start refusing connections. </p>
  
  <p>Unfortunately, all the <code>Connectors</code> appear to just go ahead and accept incoming connections as fast as they can and dispatch them to the configured thread pool.</p>
  
  <p>My problem is that I'm running in a constrained environment, and I only have access to 8K file descriptors. If I get a bunch of connections coming in I can quickly run out of file descriptors and get into an inconsistent state. </p>
  
  <p>One option I have is to return an HTTP <code>503 Service Unavailable</code>, but that still requires me to accept and respond to the connection - and I'd have keep track of the number of incoming connections somewhere, perhaps by writing a servlet filter. </p>
  
  <p>Is there a better solution to this?</p>