kezhenxu94 commented on a change in pull request #4959:
URL: https://github.com/apache/skywalking/pull/4959#discussion_r451248736



##########
File path: 
oap-server/server-configuration/configuration-configmap/src/main/java/org/apache/skywalking/oap/server/configuration/configmap/ConfigurationConfigmapInformer.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.skywalking.oap.server.configuration.configmap;
+
+import io.kubernetes.client.informer.SharedIndexInformer;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.informer.cache.Lister;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1ConfigMap;
+import io.kubernetes.client.openapi.models.V1ConfigMapList;
+import io.kubernetes.client.util.Config;
+import java.io.IOException;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class ConfigurationConfigmapInformer {
+
+    private static ConfigurationConfigmapInformer informer;
+
+    private Lister<V1ConfigMap> configMapLister;
+
+    private SharedInformerFactory factory;
+
+    private final ExecutorService executorService = 
Executors.newSingleThreadExecutor(r -> {
+        Thread thread = new Thread(r, 
"SKYWALKING_KUBERNETES_CONFIGURATION_INFORMER");
+        thread.setDaemon(true);
+        return thread;
+    });
+
+    public static ConfigurationConfigmapInformer 
getInstance(ConfigmapConfigurationSettings settings) {
+        if (informer == null) {
+            synchronized (ConfigurationConfigmapInformer.class) {
+                if (informer == null) {
+                    informer = new ConfigurationConfigmapInformer(settings);
+                }
+            }
+        }
+        return informer;
+    }
+
+    private ConfigurationConfigmapInformer(ConfigmapConfigurationSettings 
settings) {
+
+        try {
+            doStartConfigMapInformer(settings);
+            doAddShowdownHook();
+        } catch (IOException e) {
+            log.error("cannot connect with api server in kubernetes", e);
+        }
+
+    }
+
+    private void doAddShowdownHook() {

Review comment:
       Typo `doAddShowdownHook` -> `doAddShutdownHook`




----------------------------------------------------------------
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.

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


Reply via email to