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 2022/09/13 14:29:35 UTC

[GitHub] [pulsar] nicoloboschi opened a new pull request, #17619: [fix][cli] Pulsar shell: ensure admin client is recycled or disposed

nicoloboschi opened a new pull request, #17619:
URL: https://github.com/apache/pulsar/pull/17619

   ### Motivation
   
   In Pulsar shell when creating a new admin client (using the `admin` API) is created for each command. There are two considerations:
   - the admin client is never closed (memory and tcp cnxs leak)
   - the admin client should be reused when using the same config 
   
   ### Modifications
   * Refactored the pulsar-admin main class (`PulsarAdminTool`) in order to being able to compare configurations and decide to keep or destroy the current admin client
   
   The client is discarded when:
   1. You pass a inline parameter (e.g. `--admin-url`) that is different from the current one
   2. You change config (`config use ...`) without the comparison because a new `PulsarAdminTool` is created. This makes sense because when you change the config, you change the tenant or cluster.
   
   * Fixed another leak in for custom commands. They list of custom commands continues to grow for each command and it's never cleared
   
   
   - [x] `doc-not-needed` 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] nodece commented on a diff in pull request #17619: [fix][cli] Pulsar shell: ensure admin client is recycled or disposed

Posted by GitBox <gi...@apache.org>.
nodece commented on code in PR #17619:
URL: https://github.com/apache/pulsar/pull/17619#discussion_r970447986


##########
pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/PulsarAdminSupplier.java:
##########
@@ -0,0 +1,108 @@
+/**
+ * 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.pulsar.admin.cli;
+
+import static org.apache.commons.lang3.StringUtils.isNotBlank;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
+import lombok.Data;
+import lombok.SneakyThrows;
+import org.apache.pulsar.client.admin.PulsarAdmin;
+import org.apache.pulsar.client.admin.PulsarAdminBuilder;
+
+public class PulsarAdminSupplier implements Supplier<PulsarAdmin> {
+
+    @Data
+    private static final class RootParamsKey {
+        String serviceUrl;
+        String authPluginClassName;
+        int requestTimeout;
+        String authParams;
+        Boolean tlsAllowInsecureConnection;
+        String tlsTrustCertsFilePath;
+        Boolean tlsEnableHostnameVerification;
+        String tlsProvider;

Review Comment:
   Miss the TLS transport config here, let me make a PR to do that.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] nicoloboschi merged pull request #17619: [fix][cli] Pulsar shell: ensure admin client is recycled or disposed

Posted by GitBox <gi...@apache.org>.
nicoloboschi merged PR #17619:
URL: https://github.com/apache/pulsar/pull/17619


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org