开发者

multiple instances of embedded jetty

I run an embedded jetty from eclipse using maven build configuration (jetty:run). The server starts prop开发者_C百科erly:

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜