You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by gi...@apache.org on 2019/03/09 23:14:16 UTC

[incubator-druid] branch master updated: move jetty module to Lifecycle.Stage.LAST to allow graceful shutdown to work with lookups and stuff, put http-clint on lifecycle modules lifecycle (#7215)

This is an automated email from the ASF dual-hosted git repository.

gian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 5cc1714  move jetty module to Lifecycle.Stage.LAST to allow graceful shutdown to work with lookups and stuff, put http-clint on lifecycle modules lifecycle (#7215)
5cc1714 is described below

commit 5cc171419cf64e07448b501f47114ece9c03740b
Author: Clint Wylie <cj...@gmail.com>
AuthorDate: Sat Mar 9 15:14:09 2019 -0800

    move jetty module to Lifecycle.Stage.LAST to allow graceful shutdown to work with lookups and stuff, put http-clint on lifecycle modules lifecycle (#7215)
---
 .../org/apache/druid/tests/security/ITTLSTest.java |  5 +--
 .../apache/druid/guice/http/HttpClientModule.java  |  2 +-
 .../apache/druid/guice/http/LifecycleUtils.java    | 52 ----------------------
 .../initialization/jetty/JettyServerModule.java    |  3 +-
 .../druid/server/initialization/BaseJettyTest.java |  3 +-
 5 files changed, 6 insertions(+), 59 deletions(-)

diff --git a/integration-tests/src/test/java/org/apache/druid/tests/security/ITTLSTest.java b/integration-tests/src/test/java/org/apache/druid/tests/security/ITTLSTest.java
index 1b67c64..40aaa2c 100644
--- a/integration-tests/src/test/java/org/apache/druid/tests/security/ITTLSTest.java
+++ b/integration-tests/src/test/java/org/apache/druid/tests/security/ITTLSTest.java
@@ -24,7 +24,6 @@ import com.google.common.base.Throwables;
 import com.google.inject.Inject;
 import org.apache.druid.guice.annotations.Client;
 import org.apache.druid.guice.http.DruidHttpClientConfig;
-import org.apache.druid.guice.http.LifecycleUtils;
 import org.apache.druid.https.SSLClientConfig;
 import org.apache.druid.java.util.common.ISE;
 import org.apache.druid.java.util.common.StringUtils;
@@ -391,7 +390,7 @@ public class ITTLSTest
 
     HttpClient client = HttpClientInit.createClient(
         builder.build(),
-        LifecycleUtils.asMmxLifecycle(lifecycle)
+        lifecycle
     );
 
     HttpClient adminClient = new CredentialedHttpClient(
@@ -418,7 +417,7 @@ public class ITTLSTest
 
     HttpClient client = HttpClientInit.createClient(
         builder.build(),
-        LifecycleUtils.asMmxLifecycle(lifecycle)
+        lifecycle
     );
 
     HttpClient adminClient = new CredentialedHttpClient(
diff --git a/server/src/main/java/org/apache/druid/guice/http/HttpClientModule.java b/server/src/main/java/org/apache/druid/guice/http/HttpClientModule.java
index fd173f8..ff3742f 100644
--- a/server/src/main/java/org/apache/druid/guice/http/HttpClientModule.java
+++ b/server/src/main/java/org/apache/druid/guice/http/HttpClientModule.java
@@ -150,7 +150,7 @@ public class HttpClientModule implements Module
 
       HttpClient client = HttpClientInit.createClient(
           builder.build(),
-          LifecycleUtils.asMmxLifecycle(getLifecycleProvider().get())
+          getLifecycleProvider().get()
       );
 
       if (isEscalated) {
diff --git a/server/src/main/java/org/apache/druid/guice/http/LifecycleUtils.java b/server/src/main/java/org/apache/druid/guice/http/LifecycleUtils.java
deleted file mode 100644
index c5c3428..0000000
--- a/server/src/main/java/org/apache/druid/guice/http/LifecycleUtils.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.druid.guice.http;
-
-import com.google.common.base.Throwables;
-import org.apache.druid.java.util.common.lifecycle.Lifecycle;
-
-public class LifecycleUtils
-{
-  public static Lifecycle asMmxLifecycle(Lifecycle lifecycle)
-  {
-    final Lifecycle metamxLifecycle = new Lifecycle("http-client");
-    try {
-      lifecycle.addMaybeStartHandler(new Lifecycle.Handler()
-      {
-        @Override
-        public void start() throws Exception
-        {
-          metamxLifecycle.start();
-        }
-
-        @Override
-        public void stop()
-        {
-          metamxLifecycle.stop();
-        }
-      });
-    }
-    catch (Exception e) {
-      throw Throwables.propagate(e);
-    }
-
-    return metamxLifecycle;
-  }
-}
diff --git a/server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java b/server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java
index f67613d..0454f8d 100644
--- a/server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java
+++ b/server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java
@@ -440,7 +440,8 @@ public class JettyServerModule extends JerseyServletModule
               log.warn(e, "Unable to stop Jetty server.");
             }
           }
-        }
+        },
+        Lifecycle.Stage.LAST
     );
 
     return server;
diff --git a/server/src/test/java/org/apache/druid/server/initialization/BaseJettyTest.java b/server/src/test/java/org/apache/druid/server/initialization/BaseJettyTest.java
index 75ef856..e578d39 100644
--- a/server/src/test/java/org/apache/druid/server/initialization/BaseJettyTest.java
+++ b/server/src/test/java/org/apache/druid/server/initialization/BaseJettyTest.java
@@ -24,7 +24,6 @@ import com.google.inject.Injector;
 import com.google.inject.Key;
 import com.google.inject.servlet.GuiceFilter;
 import org.apache.druid.guice.annotations.Self;
-import org.apache.druid.guice.http.LifecycleUtils;
 import org.apache.druid.java.util.common.lifecycle.Lifecycle;
 import org.apache.druid.java.util.http.client.HttpClient;
 import org.apache.druid.java.util.http.client.HttpClientConfig;
@@ -119,7 +118,7 @@ public abstract class BaseJettyTest
       try {
         this.client = HttpClientInit.createClient(
             new HttpClientConfig(maxClientConnections, SSLContext.getDefault(), Duration.ZERO),
-            LifecycleUtils.asMmxLifecycle(druidLifecycle)
+            druidLifecycle
         );
       }
       catch (Exception e) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org