You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2001/10/25 15:54:04 UTC
DO NOT REPLY [Bug 4418] New: -
Race Condition in net.serversocketfactory.java
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4418>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4418
Race Condition in net.serversocketfactory.java
Summary: Race Condition in net.serversocketfactory.java
Product: Tomcat 3
Version: 3.2.1 Final
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: Other
Component: Unknown
AssignedTo: tomcat-dev@jakarta.apache.org
ReportedBy: Pete.Sage@gefanuc.com
public static ServerSocketFactory getDefault () {
//
// optimize typical case: no synch needed
//
if (theFactory == null) {
synchronized (ServerSocketFactory.class) {
//
// Different implementations of this method could
// work rather differently. For example, driving
// this from a system property, or using a different
// implementation than JavaSoft's.
//
theFactory = new DefaultServerSocketFactory ();
}
}
This code is incorrect as the intention is to only ever create 1
defaultserversocketfactory. Code should be changed to something like
public static ServerSocketFactory getDefault () {
//
// optimize typical case: no synch needed
//
if (theFactory == null) {
synchronized (ServerSocketFactory.class) {
//
// Different implementations of this method could
// work rather differently. For example, driving
// this from a system property, or using a different
// implementation than JavaSoft's.
//
if (theFactory == NULL) {
theFactory = new DefaultServerSocketFactory ();
}
}
}