Skip to content

Commit 85a53c2

Browse files
author
chengyitian
committed
Merge branch 'dev' of dolphindb.net:dolphindb/api-java
# Conflicts: # pom.xml # src/com/xxdb/data/Utils.java
2 parents 7d199b6 + 9744224 commit 85a53c2

46 files changed

Lines changed: 6216 additions & 569 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>com.dolphindb</groupId>
44
<artifactId>dolphindb-javaapi</artifactId>
5-
<version>3.00.4.2</version>
5+
<version>3.00.5.0</version>
66
<packaging>jar</packaging>
77

88
<properties>
9-
<dolphindb.version>3.00.4.2</dolphindb.version>
9+
<dolphindb.version>3.00.5.0</dolphindb.version>
1010
</properties>
1111
<name>DolphinDB Java API</name>
1212
<description>The messaging and data conversion protocol between Java and DolphinDB server</description>
@@ -31,7 +31,7 @@
3131
<connection>scm:git:git@github.com:dolphindb/api-java.git</connection>
3232
<developerConnection>scm:git:git@github.com:dolphindb/api-java.git</developerConnection>
3333
<url>git@github.com:dolphindb/api-java.git</url>
34-
<tag>api-java-3.00.4.2</tag>
34+
<tag>api-java-3.00.5.0</tag>
3535
</scm>
3636
<dependencies>
3737
<dependency>
@@ -41,9 +41,9 @@
4141
<scope>test</scope>
4242
</dependency>
4343
<dependency>
44-
<groupId>org.lz4</groupId>
44+
<groupId>at.yawk.lz4</groupId>
4545
<artifactId>lz4-java</artifactId>
46-
<version>1.7.1</version>
46+
<version>1.10.2</version>
4747
</dependency>
4848
<dependency>
4949
<groupId>com.alibaba.fastjson2</groupId>

src/com/xxdb/DBConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ public ExceptionType parseException(String msg, Node node) {
13991399
log.info("New leader is " + node.hostName + ":" + node.port);
14001400
return ExceptionType.ET_NEWLEADER;
14011401
}
1402-
}else if (msg.contains("<DataNodeNotAvail>") || msg.contains("<DataNodeNotReady>")){
1402+
}else if (msg.contains("<DataNodeNotAvail>") || msg.contains("<DataNodeNotReady>") || msg.contains("Public key is not initialized yet")){
14031403
node.hostName = "";
14041404
node.port = 0;
14051405
return ExceptionType.ET_NODENOTAVAIL;

src/com/xxdb/SimpleDBConnectionPoolConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ protected void validate() {
248248

249249
if (idleTimeout < 10000) {
250250
idleTimeout = 600000;
251-
log.warn("The param 'idleTimeout' cannot less than 10000ms will use the default value 600000ms(10min)");
251+
log.warn("The param 'idleTimeout' cannot less than 10000ms, will use the default value 600000ms(10min)");
252252
}
253253
}
254254

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.xxdb.comm;
2+
3+
/**
4+
* Represents the connection state of a replication target.
5+
*/
6+
public enum ConnectionState {
7+
/**
8+
* The connection is being initialized.
9+
*/
10+
Initializing,
11+
12+
/**
13+
* The connection is active and ready for data transfer.
14+
*/
15+
Connected,
16+
17+
/**
18+
* The connection has been terminated.
19+
*/
20+
Terminated,
21+
22+
/**
23+
* The connection is attempting to reconnect.
24+
*/
25+
Reconnecting
26+
}

src/com/xxdb/compression/LZ4Decoder.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
package com.xxdb.compression;
22

3-
import com.xxdb.data.Entity;
43
import com.xxdb.io.BigEndianDataInputStream;
54
import com.xxdb.io.DdbByteArrayInputStream;
65
import com.xxdb.io.ExtendedDataInput;
76
import com.xxdb.io.LittleEndianDataInputStream;
87
import net.jpountz.lz4.LZ4Factory;
98
import net.jpountz.lz4.LZ4SafeDecompressor;
10-
11-
import java.io.ByteArrayInputStream;
129
import java.io.DataInput;
1310
import java.io.IOException;
14-
import java.util.Arrays;
1511
import java.util.LinkedList;
1612

1713
public class LZ4Decoder extends AbstractDecoder {

src/com/xxdb/compression/LZ4Encoder.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
package com.xxdb.compression;
22

33
import com.xxdb.data.AbstractVector;
4-
5-
import com.xxdb.data.BasicStringVector;
64
import net.jpountz.lz4.LZ4Compressor;
75
import net.jpountz.lz4.LZ4Factory;
8-
96
import java.io.*;
107
import java.nio.ByteBuffer;
118
import java.nio.ByteOrder;
129

13-
1410
import static com.xxdb.data.Utils.reAllocByteBuffer;
1511

1612
public class LZ4Encoder implements Encoder {

src/com/xxdb/data/BasicAnyVector.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ public void Append(Vector value) {
133133
values.add(value);
134134
}
135135

136+
public void Append(Entity value) {
137+
values.add(value);
138+
}
139+
136140
@Override
137141
public void checkCapacity(int requiredCapacity) {
138142
throw new RuntimeException("BasicAnyVector not support checkCapacity.");

src/com/xxdb/data/Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
public class Utils {
1818

19-
public static final String JAVA_API_VERSION = "3.00.4.2";
19+
public static final String JAVA_API_VERSION = "3.00.5.0";
2020

2121
public static final int DISPLAY_ROWS = 20;
2222
public static final int DISPLAY_COLS = 100;
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
package com.xxdb.replicator;
2+
3+
/**
4+
* Host information for StreamReplicator connection.
5+
* Contains connection details for a DolphinDB server node.
6+
*/
7+
public class HostInfo {
8+
private final String host;
9+
private final int port;
10+
private final String userId;
11+
private final String password;
12+
private final String label;
13+
14+
/**
15+
* Creates a new HostInfo with the specified connection details.
16+
*
17+
* @param host The hostname or IP address of the DolphinDB server
18+
* @param port The port number of the DolphinDB server
19+
* @param userId The user ID for authentication
20+
* @param password The password for authentication
21+
* @param label A unique label to identify this host
22+
*/
23+
public HostInfo(String host, int port, String userId, String password, String label) {
24+
if (host == null || host.isEmpty()) {
25+
throw new IllegalArgumentException("The param 'host' cannot be null or empty.");
26+
}
27+
28+
if (port <= 0 || port > 65535) {
29+
throw new IllegalArgumentException("The param 'port' must be between 1 and 65535.");
30+
}
31+
32+
if (label == null || label.isEmpty()) {
33+
throw new IllegalArgumentException("The param 'label' cannot be null or empty.");
34+
}
35+
36+
this.host = host;
37+
this.port = port;
38+
this.userId = userId;
39+
this.password = password;
40+
this.label = label;
41+
}
42+
43+
public String getHost() {
44+
return host;
45+
}
46+
47+
public int getPort() {
48+
return port;
49+
}
50+
51+
public String getUserId() {
52+
return userId;
53+
}
54+
55+
public String getPassword() {
56+
return password;
57+
}
58+
59+
public String getLabel() {
60+
return label;
61+
}
62+
63+
@Override
64+
public String toString() {
65+
return String.format("HostInfo{label='%s', host='%s', port=%d, userId='%s'}",
66+
label, host, port, userId);
67+
}
68+
69+
@Override
70+
public boolean equals(Object o) {
71+
if (this == o) return true;
72+
if (o == null || getClass() != o.getClass()) return false;
73+
HostInfo hostInfo = (HostInfo) o;
74+
return port == hostInfo.port &&
75+
host.equals(hostInfo.host) &&
76+
label.equals(hostInfo.label);
77+
}
78+
79+
@Override
80+
public int hashCode() {
81+
int result = host.hashCode();
82+
result = 31 * result + port;
83+
result = 31 * result + label.hashCode();
84+
return result;
85+
}
86+
}

0 commit comments

Comments
 (0)