title: Using NIO Http Connector in Tomcat 7 - its limiting me to one connection?
body: <p>I want to make a service that basically holds a connection till a second connection is made to tell it to stop holding the first one.</p>
  
  <p>Using NIO Http Connector with all default settings (in Tomcat and the connector).</p>
  
  <p>I use a thread (much like the "messageSender" class in the tomcat aio doc) to hold the first response and write/flush a character every 5 seconds. This is working fine - the thread holds it and releases it on cue. The only problem is that the service ('event' method) does not get a second call (for the second connection's 'begin' event) till I close the first connection.</p>
  
  <p>So to repeat, this is what happens:</p>
  
  <p>connection 1 - > tomcat creates thread 'http-nio-8081-exec-2' which calls myService.event(event);</p>
  
  <p>myService.event gives the response to 'myDaemonThread' (which holds the reference and writes to the response every 5 seconds). exits method.</p>
  
  <p>'myDaemonThread' uses "synchronized (this){ this.wait(5000); }" for waiting (initially used Thread.sleep() but in an attempt to make this work, I changed to wait() )</p>
  
  <p>connection 2 - > initiated but no thread calls myService.event</p>
  
  <p>connection 1 is stopped in the browser, tomcat creates thread 'http-nio-8081-exec-4' which calls myService.event(event.END). exits method.</p>
  
  <p>tomcat (creates ?? now or earlier, cant tell) thread 'http-nio-8081-exec-6' calls myService.event(event.BEGIN) for connection two.</p>
  
  <p>...... the rest is unimportant.</p>
  
  <p>So this seems to defeat the entire purpose of using NIO... anyone have any idea why this is happening?</p>