isaac.hazan
isaac.hazan

Reputation: 3874

Tomcat: is NIO used although not being configured?

According to the following article : http://java.dzone.com/articles/understanding-tomcat-nio , the way to know if a Tomcat instance uses NIO(and not BIO) is to look for:

INFO: Initializing ProtocolHandler ["http-nio-8080"]

On my Tomcat server I have:

grep "Initializing ProtocolHandler" /opt/tomcat/logs/*
/opt/tomcat/logs/catalina.2015-02-23.log:23-Feb-2015 15:20:00.627 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
/opt/tomcat/logs/catalina.2015-02-23.log:23-Feb-2015 15:20:00.665 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]

However my server.xml does not contain anything that tells it to use NIO, my connector looks as follows:

<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

In other terms i didn't set the protocol to use org.apache.coyote.http11.Http11NioProtocol as in the above article.

How is it that still the server seems to be using NIO?

-- Additional information

Thx in advance

Upvotes: 3

Views: 2058

Answers (1)

elsadek
elsadek

Reputation: 1086

However my server.xml does contain anything that tells it to use NIO,

NIO is the default HTTP and AJP connector implementation for the Tomcat 8.

The default HTTP and AJP connector implementation has switched from the Java blocking IO implementation (BIO) to the Java non-blocking IO implementation (NIO). BIO may still be used but Servlet 3.1 and WebSocket 1.0 features that use non-blocking IO will then use blocking IO instead which may cause unexpected application behavior.

http://tomcat.apache.org/migration-8.html#Default_connector_implementation

Upvotes: 3

Related Questions