Skip to content

Commit

Permalink
Unify the versions of third-party packages used by each module to red…
Browse files Browse the repository at this point in the history
…uce the size of the installation package (wgzhao#461)

---
By this method, the size of the installation package was reduced by 200MB
  • Loading branch information
wgzhao authored Dec 2, 2021
1 parent 2bc0f47 commit a894fab
Show file tree
Hide file tree
Showing 45 changed files with 194 additions and 162 deletions.
6 changes: 6 additions & 0 deletions common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
<version>${commons.io.version}</version>
</dependency>

<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>${commons.logging.version}</version>
</dependency>

<dependency>
<groupId>org.anarres.lzo</groupId>
<artifactId>lzo-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,4 @@ public BigInteger asBigInteger()
throw AddaxException.asAddaxException(
CommonErrorCode.CONVERT_NOT_SUPPORT, "Timestamp类型不能转为BigInteger .");
}

public static void main(String[] args)
throws SQLException
{
String s = "2021-09-27 11:12:13.123456";
Connection connection = DriverManager.getConnection("jdbc:mysql://10.60.172.153:3306/test", "wbuser", "wbuser123");
Statement statement = connection.createStatement();
statement.executeQuery("truncate table addax_write");
PreparedStatement preparedStatement = connection.prepareStatement("insert into addax_write values(?)");
Column column = new TimestampColumn(s);
preparedStatement.setTimestamp(1, column.asTimestamp());
preparedStatement.execute();
preparedStatement.close();
connection.close();
}
}
34 changes: 17 additions & 17 deletions common/src/main/java/com/wgzhao/addax/common/statistics/VMInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,10 @@ private static class PhyOSStatus

public String toString()
{
return String.format("\ttotalPhysicalMemory:\t%,.2fG\n"
+ "\tfreePhysicalMemory:\t%,.2fG\n"
+ "\tmaxFileDescriptorCount:\t%s\n"
+ "\tcurrentOpenFileDescriptorCount:\t%s\n",
return String.format("\ttotalPhysicalMemory:\t%,.2fG%n"
+ "\tfreePhysicalMemory:\t%,.2fG%n"
+ "\tmaxFileDescriptorCount:\t%s%n"
+ "\tcurrentOpenFileDescriptorCount:\t%s%n",
(float) totalPhysicalMemory / GB, (float) freePhysicalMemory / GB, maxFileDescriptorCount, currentOpenFileDescriptorCount);
}
}
Expand All @@ -251,7 +251,7 @@ public String getDeltaString()
for (GCStatus gc : gcStatusMap.values()) {
sb.append("\t\t ");
sb.append(String.format("%-20s | %-18s | %-18s | %-18s | %-18s | %-18s | %-18s | " +
"%-18s | %-18s \n",
"%-18s | %-18s %n",
gc.name, gc.curDeltaGCCount, gc.totalGCCount, gc.maxDeltaGCCount, gc.minDeltaGCCount,
String.format("%,.3fs", (float) gc.curDeltaGCTime / 1000),
String.format("%,.3fs", (float) gc.totalGCTime / 1000),
Expand All @@ -266,11 +266,11 @@ public String getTotalString()
StringBuilder sb = new StringBuilder();
sb.append("\n\t [total gc info] => \n");
sb.append("\t\t ");
sb.append(String.format("%-20s | %-18s | %-18s | %-18s | %-18s | %-18s | %-18s \n",
sb.append(String.format("%-20s | %-18s | %-18s | %-18s | %-18s | %-18s | %-18s %n",
"NAME", "totalGCCount", "maxDeltaGCCount", "minDeltaGCCount", "totalGCTime", "maxDeltaGCTime", "minDeltaGCTime"));
for (GCStatus gc : gcStatusMap.values()) {
sb.append("\t\t ");
sb.append(String.format("%-20s | %-18s | %-18s | %-18s | %-18s | %-18s | %-18s \n",
sb.append(String.format("%-20s | %-18s | %-18s | %-18s | %-18s | %-18s | %-18s %n",
gc.name, gc.totalGCCount, gc.maxDeltaGCCount, gc.minDeltaGCCount,
String.format("%,.3fs", (float) gc.totalGCTime / 1000),
String.format("%,.3fs", (float) gc.maxDeltaGCTime / 1000),
Expand All @@ -288,10 +288,10 @@ public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("\t");
sb.append(String.format("%-30s | %-30s | %-30s \n", "MEMORY_NAME", "allocation_size", "init_size"));
sb.append(String.format("%-30s | %-30s | %-30s %n", "MEMORY_NAME", "allocation_size", "init_size"));
for (MemoryStatus ms : memoryStatusMap.values()) {
sb.append("\t");
sb.append(String.format("%-30s | %-30s | %-30s \n",
sb.append(String.format("%-30s | %-30s | %-30s %n",
ms.name, String.format("%,.2fMB", (float) ms.maxSize / MB), String.format("%,.2fMB", (float) ms.initSize / MB)));
}
return sb.toString();
Expand All @@ -302,11 +302,11 @@ public String getDeltaString()
StringBuilder sb = new StringBuilder();
sb.append("\n\t [delta memory info] => \n");
sb.append("\t\t ");
sb.append(String.format("%-30s | %-30s | %-30s | %-30s | %-30s \n", "NAME",
sb.append(String.format("%-30s | %-30s | %-30s | %-30s | %-30s %n", "NAME",
"used_size", "used_percent", "max_used_size", "max_percent"));
for (MemoryStatus ms : memoryStatusMap.values()) {
sb.append("\t\t ");
sb.append(String.format("%-30s | %-30s | %-30s | %-30s | %-30s \n",
sb.append(String.format("%-30s | %-30s | %-30s | %-30s | %-30s %n",
ms.name, String.format("%,.2f", (float) ms.usedSize / MB) + "MB",
String.format("%,.2f", ms.percent) + "%",
String.format("%,.2f", (float) ms.maxUsedSize / MB) + "MB",
Expand Down Expand Up @@ -410,26 +410,26 @@ public String getDeltaString()

return "\n\t [delta cpu info] => \n" +
"\t\t" +
String.format("%-30s | %-30s | %-30s | %-30s \n", "curDeltaCpu", "averageCpu", "maxDeltaCpu", "minDeltaCpu") +
String.format("%-30s | %-30s | %-30s | %-30s %n", "curDeltaCpu", "averageCpu", "maxDeltaCpu", "minDeltaCpu") +
"\t\t" +
String.format("%-30s | %-30s | %-30s | %-30s \n",
String.format("%-30s | %-30s | %-30s | %-30s %n",
String.format("%,.2f%%", processCpuStatus.curDeltaCpu),
String.format("%,.2f%%", processCpuStatus.averageCpu),
String.format("%,.2f%%", processCpuStatus.maxDeltaCpu),
String.format("%,.2f%%\n", processCpuStatus.minDeltaCpu));
String.format("%,.2f%%%n", processCpuStatus.minDeltaCpu));
}

public String getTotalString()
{

return "\n\t [total cpu info] => \n" +
"\t\t" +
String.format("%-30s | %-30s | %-30s \n", "averageCpu", "maxDeltaCpu", "minDeltaCpu") +
String.format("%-30s | %-30s | %-30s %n", "averageCpu", "maxDeltaCpu", "minDeltaCpu") +
"\t\t" +
String.format("%-30s | %-30s | %-30s \n",
String.format("%-30s | %-30s | %-30s %n",
String.format("%,.2f%%", processCpuStatus.averageCpu),
String.format("%,.2f%%", processCpuStatus.maxDeltaCpu),
String.format("%,.2f%%\n", processCpuStatus.minDeltaCpu));
String.format("%,.2f%%%n", processCpuStatus.minDeltaCpu));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -519,12 +519,13 @@ public <T> List<T> getList(String path, Class<T> t)

List<T> result = new ArrayList<>();

List<Object> origin = new ArrayList<>();
List<Object> origin;
try {
origin = object;
}
catch (ClassCastException e) {
// .warn("{} 转为 List 时发生了异常,默认将此值添加到 List 中", String.valueOf(object))
origin = new ArrayList<>();
origin.add(String.valueOf(object));
}

Expand Down
17 changes: 11 additions & 6 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@
<version>${logback.version}</version>
</dependency>

<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>

<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
Expand All @@ -62,38 +68,37 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpasyncclient</artifactId>
<version>4.1.4</version>
<version>${httpasync.version}</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
<version>${httpclient.version}</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.14</version>
<version>${httpcore.version}</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore-nio</artifactId>
<version>4.4.14</version>
<version>${httpcore.version}</version>
</dependency>

<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<artifactId>groovy</artifactId>
<version>${groovy.version}</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>

</dependencies>

<build>
Expand Down
26 changes: 19 additions & 7 deletions lib/addax-storage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,27 @@
</dependency>

<dependency>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
<version>1.0</version>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>

<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.4</version>
<version>${commons.beanutils.version}</version>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons.io.version}</version>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>aircompressor</artifactId>
<version>0.21</version>
<version>${aircompressor.version}</version>
</dependency>

<dependency>
Expand All @@ -55,13 +61,19 @@
<dependency>
<groupId>net.sourceforge.javacsv</groupId>
<artifactId>javacsv</artifactId>
<version>2.0</version>
<version>${javacsv.version}</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.21</version>
<version>${commons.compress.version}</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons.lang3.version}</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

package com.wgzhao.addax.storage.writer;

import com.google.common.collect.Sets;
import com.wgzhao.addax.common.base.Constant;
import com.wgzhao.addax.common.base.Key;
import com.wgzhao.addax.common.compress.ZipCycleOutputStream;
Expand Down Expand Up @@ -49,6 +48,7 @@
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
Expand All @@ -57,8 +57,8 @@
public class StorageWriterUtil
{
private static final Logger LOG = LoggerFactory.getLogger(StorageWriterUtil.class);
private static final Set<String> supportedCompress = Sets.newHashSet("gzip", "bzip2", "zip");
private static final Set<String> supportedWriteModes = Sets.newHashSet("truncate", "append", "nonConflict");
private static final Set<String> supportedCompress = new HashSet<>(Arrays.asList("gzip", "bzip2", "zip"));
private static final Set<String> supportedWriteModes = new HashSet<>(Arrays.asList("truncate", "append", "nonConflict"));

private StorageWriterUtil()
{
Expand Down Expand Up @@ -122,7 +122,7 @@ public static void validateParameter(Configuration writerConfiguration)
// fieldDelimiter check
String delimiterInStr = writerConfiguration
.getString(Key.FIELD_DELIMITER);
// warn: if have, length must be one
// warn: if it has, length must be one
if (null != delimiterInStr && 1 != delimiterInStr.length()) {
throw AddaxException.asAddaxException(
StorageWriterErrorCode.ILLEGAL_VALUE,
Expand Down
2 changes: 1 addition & 1 deletion plugin/reader/cassandrareader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
<version>${commons.codec.version}</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion plugin/reader/dbfreader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<dependency>
<groupId>com.wgzhao.addax</groupId>
<artifactId>addax-storage</artifactId>
<version>4.0.8-SNAPSHOT</version>
<version>${project.version}</version>
</dependency>

<dependency>
Expand Down
8 changes: 4 additions & 4 deletions plugin/reader/elasticsearchreader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,26 @@
<dependency>
<groupId>io.searchbox</groupId>
<artifactId>jest</artifactId>
<version>6.3.1</version>
<version>${jest.version}</version>
</dependency>

<dependency>
<groupId>io.searchbox</groupId>
<artifactId>jest-common</artifactId>
<version>6.3.1</version>
<version>${jest.version}</version>
</dependency>

<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.10.13</version>
<version>${joda.time.version}</version>
</dependency>

<!-- https://mvnrepository.com/artifact/ognl/ognl -->
<dependency>
<groupId>ognl</groupId>
<artifactId>ognl</artifactId>
<version>3.2.21</version>
<version>${ognl.version}</version>
</dependency>

</dependencies>
Expand Down
6 changes: 3 additions & 3 deletions plugin/reader/excelreader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.1.0</version>
<version>${poi.version}</version>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.0.0</version>
<version>${poi.version}</version>
</dependency>

</dependencies>

<build>
Expand Down
4 changes: 2 additions & 2 deletions plugin/reader/ftpreader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.55</version>
<version>${jsch.version}</version>
</dependency>

<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.8.0</version>
<version>${commons.net.version}</version>
</dependency>

<dependency>
Expand Down
Loading

0 comments on commit a894fab

Please sign in to comment.