4

I run an embedded jetty from eclipse using maven build configuration (jetty:run). The server starts properly:

2011-07-07 13:48:11.915:INFO::Started SelectChannelConnector@0.0.0.0:8080 STARTING

[INFO] Started Jetty Server

[INFO] Starting scanner at interval of 10 seconds

Afterwards, I startup another instance listening to the same port (8080). It started properly as well. How does it possible that several instances simultaneously running and listening to the same port? BTW, my web application works fine and all the requests are going to the first instance, after shutting it down, the requests are following to the second instance. Thanks

skaffman
  • 398,947
  • 96
  • 818
  • 769
user833418
  • 41
  • 2

1 Answers1

3

This is the behaviour of the SelectChannelConnector, which uses java.nio selectors instead of java.net.Socket. I'm not sure how or why two instances are allowed to "listen" to the same port (I'm not even sure if "listen" is the right word to use for java.nio). The behaviour you're seeing is consistent, though - the second SelectChannelConnector will start receiving the messages after the first one has stopped.

You can reproduce the "traditional" behaviour by replacing SelectChannelConnector with SocketConnector.

skaffman
  • 398,947
  • 96
  • 818
  • 769