From 86c6caf608992db094b27b29b75de034f31fe94d Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Sat, 23 Sep 2017 08:47:45 +1000 Subject: [PATCH 1/2] Issue #1841 reduce ServletHolder contention --- .../eclipse/jetty/servlet/ServletHolder.java | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java index bf17dbffdf7..3c0ce02fdab 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java @@ -81,11 +81,11 @@ public class ServletHolder extends Holder implements UserIdentity.Scope private ServletRegistration.Dynamic _registration; private JspContainer _jspContainer; - private transient Servlet _servlet; - private transient Config _config; - private transient long _unavailable; - private transient boolean _enabled = true; - private transient UnavailableException _unavailableEx; + private Servlet _servlet; + private long _unavailable; + private Config _config; + private boolean _enabled = true; + private UnavailableException _unavailableEx; public static final String APACHE_SENTINEL_CLASS = "org.apache.tomcat.InstanceManager"; @@ -528,7 +528,7 @@ public class ServletHolder extends Holder implements UserIdentity.Scope */ public boolean isAvailable() { - if (isStarted()&& _unavailable==0) + if (isStarted() && _unavailable==0) return true; try { @@ -539,7 +539,7 @@ public class ServletHolder extends Holder implements UserIdentity.Scope LOG.ignore(e); } - return isStarted()&& _unavailable==0; + return isStarted() && _unavailable==0; } /* ------------------------------------------------------------ */ @@ -773,20 +773,30 @@ public class ServletHolder extends Holder implements UserIdentity.Scope baseRequest.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, mpce); } - public synchronized Servlet ensureInstance() + public Servlet ensureInstance() throws ServletException, UnavailableException { - if (_class==null) - throw new UnavailableException("Servlet Not Initialized"); - Servlet servlet=_servlet; if (!isStarted()) throw new UnavailableException("Servlet not initialized", -1); - if (_unavailable!=0 || (!_initOnStartup && servlet==null)) - servlet=getServlet(); - if (servlet==null) - throw new UnavailableException("Could not instantiate "+_class); - return servlet; + Servlet servlet=_servlet; + if (servlet!=null && _unavailable==0) + return servlet; + + synchronized(this) + { + servlet=_servlet; + if (servlet!=null) + return servlet; + if (_class == null) + throw new UnavailableException("Servlet Not Initialized"); + if (_unavailable != 0 || (!_initOnStartup && servlet == null)) + servlet = getServlet(); + if (servlet == null) + throw new UnavailableException("Could not instantiate " + _class); + + return servlet; + } } /* ------------------------------------------------------------ */ From 9163ff20bb7218df4de9af78167d184cec189510 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Sat, 23 Sep 2017 09:22:03 +1000 Subject: [PATCH 2/2] Issue #215 Conscrypt module for SSL and ALPN Added new modules to the bom --- jetty-bom/pom.xml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/jetty-bom/pom.xml b/jetty-bom/pom.xml index 17bf4590977..4f49d174136 100644 --- a/jetty-bom/pom.xml +++ b/jetty-bom/pom.xml @@ -116,6 +116,26 @@ jetty-alpn-java-server 9.4.8-SNAPSHOT + + org.eclipse.jetty + jetty-alpn-openjdk8-client + 9.4.8-SNAPSHOT + + + org.eclipse.jetty + jetty-alpn-openjdk8-server + 9.4.8-SNAPSHOT + + + org.eclipse.jetty + jetty-alpn-conscrypt-client + 9.4.8-SNAPSHOT + + + org.eclipse.jetty + jetty-alpn-conscrypt-server + 9.4.8-SNAPSHOT + org.eclipse.jetty jetty-alpn-server