tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: tomcat-6 socket.soLingerOn vs connectionLinger
Date Fri, 02 Sep 2011 10:05:54 GMT
On 02/09/2011 02:37, Chris Burroughs wrote:
> Looking at the Connector configuration options I'm having trouble
> reconciling the description of socket.soLingerOn and connectionLinger [1]

The documentation is a bit of a mess here. I'll explain what should
happen below and try and clean up the documentation.

There are three (or four) attributes to consider:
connectionLinger (a.k.a. soLinger)
socket.soLingerOn
socket.soLingerTime

The simplest way to understand how they interact is to look at the
setSoLingermethod in the endpoint

public void setSoLinger(int soLinger) {
    socketProperties.setSoLingerTime(soLinger);
    socketProperties.setSoLingerOn(soLinger>=0);
}

connectionLinger is essentially a short-cut to setting soLingerTime and
soLingerOn

> So it sounds like connectionLinger is just a way of setting
> socket.soLingerOn, but then it would be redundant to have two options.

Yes, it is redundant. connectionLinger was first and then when the
socket.* attributes were added, all the socket attributes were exposed
creating the redundancy.

> Are they about different sockets?
No.

> The defaults are also opposites.  If
> both options affect SO_LINGER time, which takes precedence?

trunk and Tomcat 7: JVM defaults are used. If both are set in server.xml
(don't do that) it depends on the order in which the attributes are read.

Tomcat 6:
 BIO & APR. Only support connectionLinger. Default 100.
 NIO. Supports all three (four). Default 25.

> Also, the units of connectionLinger are milliseconds, but
> java.net.Socket#setSoLinger uses seconds, so I'm not sure how greater
> than second precision could be achieved.

It can't. The units of connectionLinger are seconds. That is another
documentation error.

The docs have been fixed for trunk, 7.0.x and 6.0.x and will be included
in 7.0.22 & 6.0.34 onwards.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message