liubao68 commented on a change in pull request #1518: [SCB-1711] support kie
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1518#discussion_r376832350
 
 

 ##########
 File path: 
dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java
 ##########
 @@ -0,0 +1,170 @@
+/*
+ * 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.servicecomb.config.kie.client;
+
+import io.netty.handler.codec.http.HttpResponseStatus;
+import io.vertx.core.DeploymentOptions;
+import io.vertx.core.Vertx;
+import io.vertx.core.VertxOptions;
+import io.vertx.core.http.HttpClientOptions;
+import io.vertx.core.http.HttpClientRequest;
+import java.io.IOException;
+import java.util.Map;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import org.apache.http.HttpStatus;
+import 
org.apache.servicecomb.config.kie.archaius.sources.KieConfigurationSourceImpl.UpdateHandler;
+import org.apache.servicecomb.config.kie.model.KVResponse;
+import org.apache.servicecomb.foundation.common.event.EventManager;
+import org.apache.servicecomb.foundation.common.net.IpPort;
+import org.apache.servicecomb.foundation.common.net.NetUtils;
+import org.apache.servicecomb.foundation.common.utils.JsonUtils;
+import org.apache.servicecomb.foundation.vertx.AddressResolverConfig;
+import org.apache.servicecomb.foundation.vertx.VertxUtils;
+import org.apache.servicecomb.foundation.vertx.client.ClientPoolManager;
+import org.apache.servicecomb.foundation.vertx.client.ClientVerticle;
+import 
org.apache.servicecomb.foundation.vertx.client.http.HttpClientPoolFactory;
+import 
org.apache.servicecomb.foundation.vertx.client.http.HttpClientWithContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @Author GuoYl123
+ * @Date 2020/1/9
+ **/
+public class KieClient {
+
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(KieClient.class);
+
+  private ScheduledExecutorService EXECUTOR = 
Executors.newScheduledThreadPool(1);
+
+  private static final long TIME_OUT = 10000;
+
+  private static final KieConfig KIE_CONFIG = KieConfig.INSTANCE;
+
+  private final int refreshInterval = KIE_CONFIG.getRefreshInterval();
+
+  private final int firstRefreshInterval = 
KIE_CONFIG.getFirstRefreshInterval();
+
+  private final String serviceUri = KIE_CONFIG.getServerUri();
+
+  private ClientPoolManager<HttpClientWithContext> clientMgr;
+
+  public KieClient(UpdateHandler updateHandler) {
+    KieWatcher.INSTANCE.setUpdateHandler(updateHandler);
+  }
+
+  public void refreshKieConfig() {
+    try {
+      deployConfigClient();
+    } catch (InterruptedException e) {
+      throw new IllegalStateException(e);
+    }
+    EXECUTOR
+        .scheduleWithFixedDelay(new ConfigRefresh(serviceUri), 
firstRefreshInterval,
+            refreshInterval, TimeUnit.SECONDS);
+  }
+
+  private void deployConfigClient() throws InterruptedException {
+    VertxOptions vertxOptions = new VertxOptions();
+    //todo :  how to deal with it
 
 Review comment:
   This TODO does not tell what is going to be done. 

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


With regards,
Apache Git Services

Reply via email to