JBossWeb SVN: r2230 - branches/JBOSSWEB_7_0_17_FINNAL_BZ-981516/java/org/apache/coyote/http11.
by jbossweb-commits@lists.jboss.org
Author: aogburn
Date: 2013-07-04 23:44:45 -0400 (Thu, 04 Jul 2013)
New Revision: 2230
Modified:
branches/JBOSSWEB_7_0_17_FINNAL_BZ-981516/java/org/apache/coyote/http11/Http11Protocol.java
Log:
[BZ-981516] commit fix
Modified: branches/JBOSSWEB_7_0_17_FINNAL_BZ-981516/java/org/apache/coyote/http11/Http11Protocol.java
===================================================================
--- branches/JBOSSWEB_7_0_17_FINNAL_BZ-981516/java/org/apache/coyote/http11/Http11Protocol.java 2013-07-05 03:23:05 UTC (rev 2229)
+++ branches/JBOSSWEB_7_0_17_FINNAL_BZ-981516/java/org/apache/coyote/http11/Http11Protocol.java 2013-07-05 03:44:45 UTC (rev 2230)
@@ -72,7 +72,10 @@
protected static StringManager sm =
StringManager.getManager(Constants.Package);
+ private static final Object syncInitLock = new Object();
+ private boolean SYNC_INIT = Boolean.valueOf(System.getProperty("org.apache.coyote.http11.Http11Protocol.SYNC_INIT")).booleanValue();
+
// ------------------------------------------------------------ Constructor
@@ -157,43 +160,88 @@
}
public void init() throws Exception {
- endpoint.setName(getName());
- endpoint.setHandler(cHandler);
+ if(!SYNC_INIT) {
+ endpoint.setName(getName());
+ endpoint.setHandler(cHandler);
- // Verify the validity of the configured socket factory
- try {
- if (isSSLEnabled()) {
- sslImplementation =
- SSLImplementation.getInstance(sslImplementationName);
- socketFactory = sslImplementation.getServerSocketFactory();
- endpoint.setServerSocketFactory(socketFactory);
- } else if (socketFactoryName != null) {
- socketFactory = (ServerSocketFactory) Class.forName(socketFactoryName).newInstance();
- endpoint.setServerSocketFactory(socketFactory);
+ // Verify the validity of the configured socket factory
+ try {
+ if (isSSLEnabled()) {
+ sslImplementation =
+ SSLImplementation.getInstance(sslImplementationName);
+ socketFactory = sslImplementation.getServerSocketFactory();
+ endpoint.setServerSocketFactory(socketFactory);
+ } else if (socketFactoryName != null) {
+ socketFactory = (ServerSocketFactory) Class.forName(socketFactoryName).newInstance();
+ endpoint.setServerSocketFactory(socketFactory);
+ }
+ } catch (Exception ex) {
+ log.error(sm.getString("http11protocol.socketfactory.initerror"),
+ ex);
+ throw ex;
}
- } catch (Exception ex) {
- log.error(sm.getString("http11protocol.socketfactory.initerror"),
- ex);
- throw ex;
- }
- if (socketFactory!=null) {
- Iterator<String> attE = attributes.keySet().iterator();
- while( attE.hasNext() ) {
- String key = attE.next();
- Object v=attributes.get(key);
- socketFactory.setAttribute(key, v);
+ if (socketFactory!=null) {
+ Iterator<String> attE = attributes.keySet().iterator();
+ while( attE.hasNext() ) {
+ String key = attE.next();
+ Object v=attributes.get(key);
+ socketFactory.setAttribute(key, v);
+ }
}
- }
- try {
- endpoint.init();
- } catch (Exception ex) {
- log.error(sm.getString("http11protocol.endpoint.initerror"), ex);
- throw ex;
+ try {
+ endpoint.init();
+ } catch (Exception ex) {
+ log.error(sm.getString("http11protocol.endpoint.initerror"), ex);
+ throw ex;
+ }
+ if (log.isDebugEnabled())
+ log.debug(sm.getString("http11protocol.init", getName()));
+ } else {
+ synchronized ( syncInitLock ){
+ if (log.isTraceEnabled())
+ log.trace("Doing sync http init");
+
+ endpoint.setName(getName());
+ endpoint.setHandler(cHandler);
+
+ // Verify the validity of the configured socket factory
+ try {
+ if (isSSLEnabled()) {
+ sslImplementation =
+ SSLImplementation.getInstance(sslImplementationName);
+ socketFactory = sslImplementation.getServerSocketFactory();
+ endpoint.setServerSocketFactory(socketFactory);
+ } else if (socketFactoryName != null) {
+ socketFactory = (ServerSocketFactory) Class.forName(socketFactoryName).newInstance();
+ endpoint.setServerSocketFactory(socketFactory);
+ }
+ } catch (Exception ex) {
+ log.error(sm.getString("http11protocol.socketfactory.initerror"),
+ ex);
+ throw ex;
+ }
+
+ if (socketFactory!=null) {
+ Iterator<String> attE = attributes.keySet().iterator();
+ while( attE.hasNext() ) {
+ String key = attE.next();
+ Object v=attributes.get(key);
+ socketFactory.setAttribute(key, v);
+ }
+ }
+
+ try {
+ endpoint.init();
+ } catch (Exception ex) {
+ log.error(sm.getString("http11protocol.endpoint.initerror"), ex);
+ throw ex;
+ }
+ if (log.isDebugEnabled())
+ log.debug(sm.getString("http11protocol.init", getName()));
+ }
}
- if (log.isDebugEnabled())
- log.debug(sm.getString("http11protocol.init", getName()));
}