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 1b67c6407b8..40aaa2c49a6 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 fd173f864b9..ff3742fd27a 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 c5c3428349c..00000000000 --- 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 f67613d207e..0454f8d0f28 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 75ef8560217..e578d3993ad 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) {