You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/02/24 12:15:27 UTC

[GitHub] [incubator-inlong] baomingyu commented on a change in pull request #2683: [INLONG-2682][Manager] Add stream metric and stream config log related interface

baomingyu commented on a change in pull request #2683:
URL: https://github.com/apache/incubator-inlong/pull/2683#discussion_r813822093



##########
File path: inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/AbstractService.java
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.inlong.manager.service.core.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Value;
+
+public abstract class AbstractService<T> implements AutoCloseable, InitializingBean {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(AbstractService.class);
+
+    @Value("${msg.to.db.batch.size:10}")
+    private int batchSize = 10;
+
+    @Value("${msg.to.db.queue.size:10000}")
+    private int queueSize = 10000;
+
+    private volatile boolean isClose = false;
+
+    private LinkedBlockingQueue<T> dataQueue;
+
+    abstract boolean batchInsertEntities(List<T> entryList);
+
+    public boolean putData(T data) {
+        if (dataQueue == null) {
+            return false;
+        }
+        return dataQueue.offer(data);
+    }
+
+    @Override
+    public void close() throws Exception {
+        isClose = true;
+    }
+
+    public void afterPropertiesSet() throws Exception {
+        dataQueue = new LinkedBlockingQueue(queueSize);
+        new Thread(() -> start(), "Batch_insert").start();

Review comment:
       done

##########
File path: inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/AbstractService.java
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.inlong.manager.service.core.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Value;
+
+public abstract class AbstractService<T> implements AutoCloseable, InitializingBean {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(AbstractService.class);
+
+    @Value("${msg.to.db.batch.size:10}")
+    private int batchSize = 10;
+
+    @Value("${msg.to.db.queue.size:10000}")
+    private int queueSize = 10000;
+
+    private volatile boolean isClose = false;
+
+    private LinkedBlockingQueue<T> dataQueue;
+
+    abstract boolean batchInsertEntities(List<T> entryList);
+
+    public boolean putData(T data) {

Review comment:
       done

##########
File path: inlong-manager/manager-dao/src/main/resources/generatorConfig.xml
##########
@@ -38,7 +38,7 @@
         <!-- Database connection URL, username, password -->
         <jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
                 connectionURL="jdbc:mysql://127.0.0.1:3306/apache_inlong_manager?nullCatalogMeansCurrent=true"
-                userId="root" password="inlong">
+                userId="root" password="12345678">

Review comment:
       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.

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

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