You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/10/22 18:25:56 UTC

[GitHub] ivankelly closed pull request #2811: Bump jetty to v9.4.12

ivankelly closed pull request #2811: Bump jetty to v9.4.12
URL: https://github.com/apache/pulsar/pull/2811
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/distribution/server/src/assemble/LICENSE.bin.txt b/distribution/server/src/assemble/LICENSE.bin.txt
index 0daca02684..1a3774c1fa 100644
--- a/distribution/server/src/assemble/LICENSE.bin.txt
+++ b/distribution/server/src/assemble/LICENSE.bin.txt
@@ -395,22 +395,23 @@ The Apache Software License, Version 2.0
     - org.asynchttpclient-async-http-client-2.1.0-alpha26.jar
     - org.asynchttpclient-async-http-client-netty-utils-2.1.0-alpha26.jar
  * Jetty
-    - org.eclipse.jetty-jetty-client-9.3.11.v20160721.jar
-    - org.eclipse.jetty-jetty-continuation-9.3.11.v20160721.jar
-    - org.eclipse.jetty-jetty-http-9.3.11.v20160721.jar
-    - org.eclipse.jetty-jetty-io-9.3.11.v20160721.jar
-    - org.eclipse.jetty-jetty-proxy-9.3.11.v20160721.jar
-    - org.eclipse.jetty-jetty-security-9.3.11.v20160721.jar
-    - org.eclipse.jetty-jetty-server-9.3.11.v20160721.jar
-    - org.eclipse.jetty-jetty-servlet-9.3.11.v20160721.jar
-    - org.eclipse.jetty-jetty-servlets-9.3.11.v20160721.jar
-    - org.eclipse.jetty-jetty-util-9.3.11.v20160721.jar
-    - org.eclipse.jetty.websocket-javax-websocket-client-impl-9.3.11.v20160721.jar
-    - org.eclipse.jetty.websocket-websocket-api-9.3.11.v20160721.jar
-    - org.eclipse.jetty.websocket-websocket-client-9.3.11.v20160721.jar
-    - org.eclipse.jetty.websocket-websocket-common-9.3.11.v20160721.jar
-    - org.eclipse.jetty.websocket-websocket-server-9.3.11.v20160721.jar
-    - org.eclipse.jetty.websocket-websocket-servlet-9.3.11.v20160721.jar
+    - org.eclipse.jetty-jetty-client-9.4.12.v20180830.jar
+    - org.eclipse.jetty-jetty-continuation-9.4.12.v20180830.jar
+    - org.eclipse.jetty-jetty-http-9.4.12.v20180830.jar
+    - org.eclipse.jetty-jetty-io-9.4.12.v20180830.jar
+    - org.eclipse.jetty-jetty-proxy-9.4.12.v20180830.jar
+    - org.eclipse.jetty-jetty-security-9.4.12.v20180830.jar
+    - org.eclipse.jetty-jetty-server-9.4.12.v20180830.jar
+    - org.eclipse.jetty-jetty-servlet-9.4.12.v20180830.jar
+    - org.eclipse.jetty-jetty-servlets-9.4.12.v20180830.jar
+    - org.eclipse.jetty-jetty-util-9.4.12.v20180830.jar
+    - org.eclipse.jetty-jetty-xml-9.4.12.v20180830.jar
+    - org.eclipse.jetty.websocket-javax-websocket-client-impl-9.4.12.v20180830.jar
+    - org.eclipse.jetty.websocket-websocket-api-9.4.12.v20180830.jar
+    - org.eclipse.jetty.websocket-websocket-client-9.4.12.v20180830.jar
+    - org.eclipse.jetty.websocket-websocket-common-9.4.12.v20180830.jar
+    - org.eclipse.jetty.websocket-websocket-server-9.4.12.v20180830.jar
+    - org.eclipse.jetty.websocket-websocket-servlet-9.4.12.v20180830.jar
  * SnakeYaml -- org.yaml-snakeyaml-1.15.jar
  * RocksDB - org.rocksdb-rocksdbjni-5.13.3.jar
  * HttpClient
@@ -501,7 +502,7 @@ CDDL-1.1 -- licenses/LICENSE-CDDL-1.1.txt
  * Java Annotations API
     - javax.annotation-javax.annotation-api-1.2.jar
  * Java Servlet API -- javax.servlet-javax.servlet-api-3.1.0.jar
- * WebSocket Server API -- javax.websocket-javax.websocket-api-1.0.jar
+ * WebSocket Server API -- javax.websocket-javax.websocket-client-api-1.0.jar
  * Java Web Service REST API -- javax.ws.rs-javax.ws.rs-api-2.1.jar
  * HK2 - Dependency Injection Kernel
     - org.glassfish.hk2-hk2-api-2.5.0-b30.jar
diff --git a/distribution/server/src/assemble/NOTICE.bin.txt b/distribution/server/src/assemble/NOTICE.bin.txt
index a42d42bae0..c3c17a00ac 100644
--- a/distribution/server/src/assemble/NOTICE.bin.txt
+++ b/distribution/server/src/assemble/NOTICE.bin.txt
@@ -169,7 +169,7 @@ This product contains a forked and modified version of Tomcat Native
 ----------------------------------------------------------------------------------------------------
 
 Jetty Web Container
-Copyright 1995-2016 Mort Bay Consulting Pty Ltd.
+Copyright 1995-2018 Mort Bay Consulting Pty Ltd.
 
 The Jetty Web Container is Copyright Mort Bay Consulting Pty Ltd
 unless otherwise noted.
diff --git a/pom.xml b/pom.xml
index c751c9e6bf..cc8bc7d9a1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -144,7 +144,7 @@ flexible messaging model and an intuitive client API.</description>
     <zookeeper.version>3.4.13</zookeeper.version>
     <netty.version>4.1.22.Final</netty.version>
     <storm.version>1.0.5</storm.version>
-    <jetty.version>9.3.11.v20160721</jetty.version>
+    <jetty.version>9.4.12.v20180830</jetty.version>
     <jersey.version>2.25</jersey.version>
     <athenz.version>1.7.17</athenz.version>
     <prometheus.version>0.5.0</prometheus.version>
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/WebService.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/WebService.java
index 360c44eee0..9fa6ac98cd 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/WebService.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/WebService.java
@@ -24,8 +24,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.TimeZone;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 
 import javax.servlet.DispatcherType;
 
@@ -59,7 +57,6 @@
 import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
 import com.google.common.collect.Lists;
 
-import io.netty.util.concurrent.DefaultThreadFactory;
 import io.prometheus.client.jetty.JettyStatisticsCollector;
 
 /**
@@ -71,19 +68,19 @@
 
     public static final String ATTRIBUTE_PULSAR_NAME = "pulsar";
     public static final String HANDLER_CACHE_CONTROL = "max-age=3600";
-    public static final int NUM_ACCEPTORS = 32; // make it configurable?
     public static final int MAX_CONCURRENT_REQUESTS = 1024; // make it configurable?
 
     private final PulsarService pulsar;
     private final Server server;
     private final List<Handler> handlers;
-    private final ExecutorService webServiceExecutor;
+    private final ExecutorThreadPool webServiceExecutor;
 
     public WebService(PulsarService pulsar) throws PulsarServerException {
         this.handlers = Lists.newArrayList();
         this.pulsar = pulsar;
-        this.webServiceExecutor = Executors.newFixedThreadPool(WebService.NUM_ACCEPTORS, new DefaultThreadFactory("pulsar-web"));
-        this.server = new Server(new ExecutorThreadPool(webServiceExecutor));
+        this.webServiceExecutor = new ExecutorThreadPool();
+        this.webServiceExecutor.setName("pulsar-web");
+        this.server = new Server(webServiceExecutor);
         List<ServerConnector> connectors = new ArrayList<>();
 
         ServerConnector connector = new PulsarServerConnector(server, 1, 1);
@@ -169,9 +166,15 @@ public void start() throws PulsarServerException {
             handlers.add(0, new ContextHandlerCollection());
             handlers.add(requestLogHandler);
 
+            ContextHandlerCollection contexts = new ContextHandlerCollection();
+            contexts.setHandlers(handlers.toArray(new Handler[handlers.size()]));
+
+            HandlerCollection handlerCollection = new HandlerCollection();
+            handlerCollection.setHandlers(new Handler[] { contexts, new DefaultHandler(), requestLogHandler });
+
             // Metrics handler
             StatisticsHandler stats = new StatisticsHandler();
-            stats.setHandler(server.getHandler());
+            stats.setHandler(handlerCollection);
             try {
                 new JettyStatisticsCollector(stats).register();
             } catch (IllegalArgumentException e) {
@@ -179,12 +182,7 @@ public void start() throws PulsarServerException {
             }
             handlers.add(stats);
 
-            ContextHandlerCollection contexts = new ContextHandlerCollection();
-            contexts.setHandlers(handlers.toArray(new Handler[handlers.size()]));
-
-            HandlerCollection handlerCollection = new HandlerCollection();
-            handlerCollection.setHandlers(new Handler[] { contexts, new DefaultHandler(), requestLogHandler, stats });
-            server.setHandler(handlerCollection);
+            server.setHandler(stats);
 
             server.start();
 
@@ -198,7 +196,7 @@ public void start() throws PulsarServerException {
     public void close() throws PulsarServerException {
         try {
             server.stop();
-            webServiceExecutor.shutdown();
+            webServiceExecutor.stop();
             log.info("Web service closed");
         } catch (Exception e) {
             throw new PulsarServerException(e);
diff --git a/pulsar-discovery-service/src/main/java/org/apache/pulsar/discovery/service/server/ServerManager.java b/pulsar-discovery-service/src/main/java/org/apache/pulsar/discovery/service/server/ServerManager.java
index f0d911f6d4..c87cd7da60 100644
--- a/pulsar-discovery-service/src/main/java/org/apache/pulsar/discovery/service/server/ServerManager.java
+++ b/pulsar-discovery-service/src/main/java/org/apache/pulsar/discovery/service/server/ServerManager.java
@@ -23,10 +23,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.TimeZone;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 
-import javax.net.ssl.SSLContext;
 import javax.servlet.Servlet;
 
 import org.apache.pulsar.common.util.SecurityUtility;
@@ -48,21 +45,20 @@
 
 import com.google.common.collect.Lists;
 
-import io.netty.util.concurrent.DefaultThreadFactory;
-
 /**
  * Manages web-service startup/stop on jetty server.
  *
  */
 public class ServerManager {
     private final Server server;
-    private final ExecutorService webServiceExecutor;
+    private final ExecutorThreadPool webServiceExecutor;
     private final List<Handler> handlers = Lists.newArrayList();
     protected final int externalServicePort;
 
     public ServerManager(ServiceConfig config) {
-        this.webServiceExecutor = Executors.newFixedThreadPool(32, new DefaultThreadFactory("pulsar-external-web"));
-        this.server = new Server(new ExecutorThreadPool(webServiceExecutor));
+        this.webServiceExecutor = new ExecutorThreadPool();
+        this.webServiceExecutor.setName("pulsar-external-web");
+        this.server = new Server(webServiceExecutor);
         this.externalServicePort = config.getWebServicePort();
 
         List<ServerConnector> connectors = Lists.newArrayList();
@@ -134,7 +130,7 @@ public void start() throws Exception {
 
     public void stop() throws Exception {
         server.stop();
-        webServiceExecutor.shutdown();
+        webServiceExecutor.stop();
         log.info("Server stopped successfully");
     }
     
diff --git a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/WorkerServer.java b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/WorkerServer.java
index a0914723a3..2a3e04cf51 100644
--- a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/WorkerServer.java
+++ b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/WorkerServer.java
@@ -26,8 +26,6 @@
 import javax.servlet.DispatcherType;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.pulsar.broker.web.AuthenticationFilter;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 import org.apache.pulsar.common.util.SecurityUtility;
 import org.apache.pulsar.functions.worker.WorkerConfig;
 import org.apache.pulsar.functions.worker.WorkerService;
@@ -55,17 +53,14 @@
 
 import com.google.common.annotations.VisibleForTesting;
 
-import io.netty.util.concurrent.DefaultThreadFactory;
-
 @Slf4j
 public class WorkerServer {
 
     private final WorkerConfig workerConfig;
     private final WorkerService workerService;
     private static final String MATCH_ALL = "/*";
-    private static final int NUM_ACCEPTORS = 16;
     private static final int MAX_CONCURRENT_REQUESTS = 1024;
-    private final ExecutorService webServerExecutor;
+    private final ExecutorThreadPool webServerExecutor;
     private Server server;
 
     private static String getErrorMessage(Server server, int port, Exception ex) {
@@ -80,7 +75,8 @@ private static String getErrorMessage(Server server, int port, Exception ex) {
     public WorkerServer(WorkerService workerService) {
         this.workerConfig = workerService.getWorkerConfig();
         this.workerService = workerService;
-        this.webServerExecutor = Executors.newFixedThreadPool(NUM_ACCEPTORS, new DefaultThreadFactory("function-web"));
+        this.webServerExecutor = new ExecutorThreadPool();
+        this.webServerExecutor.setName("function-web");
         init();
     }
 
@@ -90,7 +86,7 @@ public void start() throws Exception {
     }
     
     private void init() {
-        server = new Server(new ExecutorThreadPool(webServerExecutor));
+        server = new Server(webServerExecutor);
 
         List<ServerConnector> connectors = new ArrayList<>();
         ServerConnector connector = new ServerConnector(server, 1, 1);
@@ -167,8 +163,12 @@ public void stop() {
                 log.error("Failed to stop function web-server ", e);
             }
         }
-        if (this.webServerExecutor != null && !this.webServerExecutor.isShutdown()) {
-            this.webServerExecutor.shutdown();
+        if (this.webServerExecutor != null && this.webServerExecutor.isRunning()) {
+            try {
+                this.webServerExecutor.stop();
+            } catch (Exception e) {
+                log.warn("Error stopping function web-server executor", e);
+            }
         }
     }
     
diff --git a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/WebServer.java b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/WebServer.java
index b0bf612b30..c5618bb448 100644
--- a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/WebServer.java
+++ b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/WebServer.java
@@ -21,7 +21,6 @@
 import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
 import com.google.common.collect.Lists;
 
-import io.netty.util.concurrent.DefaultThreadFactory;
 import io.prometheus.client.jetty.JettyStatisticsCollector;
 
 import java.io.IOException;
@@ -34,8 +33,6 @@
 import java.util.List;
 import java.util.Optional;
 import java.util.TimeZone;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 
 import javax.servlet.DispatcherType;
 
@@ -72,7 +69,7 @@
     private static final String MATCH_ALL = "/*";
 
     private final Server server;
-    private final ExecutorService webServiceExecutor;
+    private final ExecutorThreadPool webServiceExecutor;
     private final AuthenticationService authenticationService;
     private final List<String> servletPaths = Lists.newArrayList();
     private final List<Handler> handlers = Lists.newArrayList();
@@ -81,8 +78,9 @@
     private URI serviceURI = null;
 
     public WebServer(ProxyConfiguration config, AuthenticationService authenticationService) {
-        this.webServiceExecutor = Executors.newFixedThreadPool(32, new DefaultThreadFactory("pulsar-external-web"));
-        this.server = new Server(new ExecutorThreadPool(webServiceExecutor));
+        this.webServiceExecutor = new ExecutorThreadPool();
+        this.webServiceExecutor.setName("pulsar-external-web");
+        this.server = new Server(webServiceExecutor);
         this.externalServicePort = config.getWebServicePort();
         this.authenticationService = authenticationService;
         this.config = config;
@@ -176,18 +174,19 @@ public void start() throws Exception {
         ContextHandlerCollection contexts = new ContextHandlerCollection();
         contexts.setHandlers(handlers.toArray(new Handler[handlers.size()]));
 
+        HandlerCollection handlerCollection = new HandlerCollection();
+        handlerCollection.setHandlers(new Handler[] { contexts, new DefaultHandler(), requestLogHandler });
+
         // Metrics handler
         StatisticsHandler stats = new StatisticsHandler();
-        stats.setHandler(server.getHandler());
+        stats.setHandler(handlerCollection);
         try {
             new JettyStatisticsCollector(stats).register();
         } catch (IllegalArgumentException e) {
             // Already registered. Eg: in unit tests
         }
 
-        HandlerCollection handlerCollection = new HandlerCollection();
-        handlerCollection.setHandlers(new Handler[] { contexts, new DefaultHandler(), requestLogHandler, stats });
-        server.setHandler(handlerCollection);
+        server.setHandler(stats);
 
         try {
             server.start();
@@ -220,7 +219,7 @@ public void start() throws Exception {
 
     public void stop() throws Exception {
         server.stop();
-        webServiceExecutor.shutdown();
+        webServiceExecutor.stop();
         log.info("Server stopped successfully");
     }
 
diff --git a/pulsar-sql/presto-distribution/LICENSE b/pulsar-sql/presto-distribution/LICENSE
index b5cd856c19..92ddc60581 100644
--- a/pulsar-sql/presto-distribution/LICENSE
+++ b/pulsar-sql/presto-distribution/LICENSE
@@ -281,7 +281,7 @@ The Apache Software License, Version 2.0
     - jetty-server-9.4.11.v20180605.jar
     - jetty-servlet-9.4.11.v20180605.jar
     - jetty-util-9.4.11.v20180605.jar
-    - jetty-util-9.3.11.v20160721.jar
+    - jetty-util-9.4.12.v20180830.jar
   * Javassist
     - javassist-3.22.0-CR2.jar
   * Asynchronous Http Client
diff --git a/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/service/ProxyServer.java b/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/service/ProxyServer.java
index 8ad6de4b3f..455b2deb59 100644
--- a/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/service/ProxyServer.java
+++ b/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/service/ProxyServer.java
@@ -21,15 +21,11 @@
 import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
 import com.google.common.collect.Lists;
 
-import io.netty.util.concurrent.DefaultThreadFactory;
-
 import java.net.MalformedURLException;
 import java.security.GeneralSecurityException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.TimeZone;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 
 import javax.servlet.Servlet;
 import javax.servlet.ServletException;
@@ -60,14 +56,14 @@
     private final Server server;
     private final List<Handler> handlers = Lists.newArrayList();
     private final WebSocketProxyConfiguration conf;
-    private final ExecutorService executorService;
+    private final ExecutorThreadPool executorService;
 
     public ProxyServer(WebSocketProxyConfiguration config)
             throws PulsarClientException, MalformedURLException, PulsarServerException {
         this.conf = config;
-        executorService = Executors.newFixedThreadPool(WebSocketProxyConfiguration.PROXY_SERVER_EXECUTOR_THREADS,
-                new DefaultThreadFactory("pulsar-websocket-web"));
-        this.server = new Server(new ExecutorThreadPool(executorService));
+        executorService = new ExecutorThreadPool();
+        executorService.setName("pulsar-websocket-web");
+        this.server = new Server(executorService);
         List<ServerConnector> connectors = new ArrayList<>();
 
         ServerConnector connector = new ServerConnector(server);
@@ -150,7 +146,7 @@ public void start() throws PulsarServerException {
 
     public void stop() throws Exception {
         server.stop();
-        executorService.shutdown();
+        executorService.stop();
     }
 
     private static final Logger log = LoggerFactory.getLogger(ProxyServer.class);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services