This is an automated email from the ASF dual-hosted git repository.
gosonzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git
The following commit(s) were added to refs/heads/master by this push:
new e21feb1 [INLONG-1996][Bug] Compile the project and InLong-Agent
module throws 3 exceptions (#2001)
e21feb1 is described below
commit e21feb118e5ba50304f75e3a0095887a4dad2533
Author: ziruipeng <[email protected]>
AuthorDate: Wed Dec 15 18:33:47 2021 +0800
[INLONG-1996][Bug] Compile the project and InLong-Agent module throws 3
exceptions (#2001)
---
.../apache/inlong/agent/plugin/sources/reader/TextFileReader.java | 8 ++++++--
.../test/java/org/apache/inlong/agent/plugin/TestFileAgent.java | 4 ++--
inlong-sort/sort-formats/pom.xml | 3 ---
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git
a/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/TextFileReader.java
b/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/TextFileReader.java
index a1a0fee..073cb2f 100755
---
a/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/TextFileReader.java
+++
b/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/TextFileReader.java
@@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Stream;
import org.apache.commons.lang3.StringUtils;
import org.apache.inlong.agent.conf.JobProfile;
@@ -62,6 +63,7 @@ public class TextFileReader implements Reader {
private long lastTime = 0;
private final PluginMetric textFileMetric;
private List<Validator> validators = new ArrayList<>();
+ private static AtomicLong metricsIndex = new AtomicLong(0);
public TextFileReader(File file, int position) {
this(file, position, "");
@@ -73,9 +75,11 @@ public class TextFileReader implements Reader {
this.md5 = md5;
if (ConfigUtil.isPrometheusEnabled()) {
- textFileMetric = new
PluginPrometheusMetric(TEXT_FILE_READER_TAG_NAME);
+ textFileMetric = new PluginPrometheusMetric(AgentUtils.getUniqId(
+ TEXT_FILE_READER_TAG_NAME, metricsIndex.incrementAndGet()));
} else {
- textFileMetric = new PluginJmxMetric(TEXT_FILE_READER_TAG_NAME);
+ textFileMetric = new PluginJmxMetric(AgentUtils.getUniqId(
+ TEXT_FILE_READER_TAG_NAME, metricsIndex.incrementAndGet()));
}
}
diff --git
a/inlong-agent/agent-plugins/src/test/java/org/apache/inlong/agent/plugin/TestFileAgent.java
b/inlong-agent/agent-plugins/src/test/java/org/apache/inlong/agent/plugin/TestFileAgent.java
index ef84909..570fc89 100755
---
a/inlong-agent/agent-plugins/src/test/java/org/apache/inlong/agent/plugin/TestFileAgent.java
+++
b/inlong-agent/agent-plugins/src/test/java/org/apache/inlong/agent/plugin/TestFileAgent.java
@@ -76,7 +76,7 @@ public class TestFileAgent {
private void createFiles(String fileName) throws Exception {
final Path hugeFile = Paths.get(testRootDir.toString(), fileName);
FileWriter writer = new FileWriter(hugeFile.toFile());
- for (int i = 0; i < 10; i++) {
+ for (int i = 0; i < 2; i++) {
writer.write(RECORD);
}
writer.flush();
@@ -85,7 +85,7 @@ public class TestFileAgent {
@Test
public void testFileAgent() throws Exception {
- for (int i = 0; i < 10; i++) {
+ for (int i = 0; i < 2; i++) {
createFiles(String.format("hugeFile.%s.txt", i));
}
createJobProfile(0);
diff --git a/inlong-sort/sort-formats/pom.xml b/inlong-sort/sort-formats/pom.xml
index 9555c6e..155d0e2 100644
--- a/inlong-sort/sort-formats/pom.xml
+++ b/inlong-sort/sort-formats/pom.xml
@@ -206,9 +206,6 @@
<forkNumber>0${surefire.forkNumber}</forkNumber>
<log4j.configuration>${log4j.configuration}</log4j.configuration>
</systemPropertyVariables>
- <argLine>-Xms256m -Xmx1024m
-Dmvn.forkNumber=${surefire.forkNumber}
- -XX:+UseG1GC
- </argLine>
</configuration>
<executions>
<!--execute all the unit tests-->