Skip to content

Commit 433f531

Browse files
gosonzhanggosonzhang
authored andcommitted
[INLONG-11656][SDK] DataProxy Java SDK lacks a common-lang dependency (#11657)
* [INLONG-11656][SDK] DataProxy Java SDK lacks a common-lang dependency * [INLONG-11656][SDK] DataProxy Java SDK lacks a common-lang dependency --------- Co-authored-by: gosonzhang <gosonzhang@tencent.com>
1 parent 0b1d207 commit 433f531

File tree

5 files changed

+28
-25
lines changed

5 files changed

+28
-25
lines changed

inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/config/ProxyConfigManager.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ private void doEncryptConfigEntryQueryWork() throws Exception {
374374
}
375375
if (result.getF0() == null) {
376376
if (this.userEncryptConfigEntry != null) {
377-
logger.warn("ConfigManager({}) connect manager({}) failure, using the last pubKey, secretId={}",
378-
this.callerId, this.encryptConfigVisitUrl, this.clientConfig.getAuthSecretId());
377+
logger.warn("ConfigManager({}) connect manager({}) failure, using the last pubKey, userName={}",
378+
this.callerId, this.encryptConfigVisitUrl, this.clientConfig.getUserName());
379379
return;
380380
}
381381
throw new Exception("Visit manager error:" + result.getF1());
@@ -570,8 +570,8 @@ private Tuple2<EncryptConfigEntry, String> requestPubKeyFromManager() {
570570
pubKeyConf = JsonParser.parseString(queryResult.getF1()).getAsJsonObject();
571571
} catch (Throwable ex) {
572572
if (parseCounter.shouldPrint()) {
573-
logger.warn("ConfigManager({}) parse failure, secretId={}, config={}!",
574-
this.callerId, this.clientConfig.getAuthSecretId(), queryResult.getF1());
573+
logger.warn("ConfigManager({}) parse failure, userName={}, config={}!",
574+
this.callerId, this.clientConfig.getUserName(), queryResult.getF1());
575575
}
576576
errorMsg = "parse pubkey failure:" + ex.getMessage();
577577
bookManagerQryFailStatus(false, errorMsg);
@@ -585,23 +585,23 @@ private Tuple2<EncryptConfigEntry, String> requestPubKeyFromManager() {
585585
try {
586586
if (!pubKeyConf.has("resultCode")) {
587587
if (parseCounter.shouldPrint()) {
588-
logger.warn("ConfigManager({}) config failure: resultCode field not exist, secretId={}, config={}!",
589-
this.callerId, this.clientConfig.getAuthSecretId(), queryResult.getF1());
588+
logger.warn("ConfigManager({}) config failure: resultCode field not exist, userName={}, config={}!",
589+
this.callerId, this.clientConfig.getUserName(), queryResult.getF1());
590590
}
591591
throw new Exception("resultCode field not exist");
592592
}
593593
int resultCode = pubKeyConf.get("resultCode").getAsInt();
594594
if (resultCode != 0) {
595595
if (parseCounter.shouldPrint()) {
596-
logger.warn("ConfigManager({}) config failure: resultCode != 0, secretId={}, config={}!",
597-
this.callerId, this.clientConfig.getAuthSecretId(), queryResult.getF1());
596+
logger.warn("ConfigManager({}) config failure: resultCode != 0, userName={}, config={}!",
597+
this.callerId, this.clientConfig.getUserName(), queryResult.getF1());
598598
}
599599
throw new Exception("resultCode != 0!");
600600
}
601601
if (!pubKeyConf.has("resultData")) {
602602
if (parseCounter.shouldPrint()) {
603-
logger.warn("ConfigManager({}) config failure: resultData field not exist, secretId={}, config={}!",
604-
this.callerId, this.clientConfig.getAuthSecretId(), queryResult.getF1());
603+
logger.warn("ConfigManager({}) config failure: resultData field not exist, userName={}, config={}!",
604+
this.callerId, this.clientConfig.getUserName(), queryResult.getF1());
605605
}
606606
throw new Exception("resultData field not exist");
607607
}
@@ -610,24 +610,24 @@ private Tuple2<EncryptConfigEntry, String> requestPubKeyFromManager() {
610610
String publicKey = resultData.get("publicKey").getAsString();
611611
if (StringUtils.isBlank(publicKey)) {
612612
if (parseCounter.shouldPrint()) {
613-
logger.warn("ConfigManager({}) config failure: publicKey is blank, secretId={}, config={}!",
614-
this.callerId, this.clientConfig.getAuthSecretId(), queryResult.getF1());
613+
logger.warn("ConfigManager({}) config failure: publicKey is blank, userName={}, config={}!",
614+
this.callerId, this.clientConfig.getUserName(), queryResult.getF1());
615615
}
616616
throw new Exception("publicKey is blank!");
617617
}
618618
String username = resultData.get("username").getAsString();
619619
if (StringUtils.isBlank(username)) {
620620
if (parseCounter.shouldPrint()) {
621-
logger.warn("ConfigManager({}) config failure: username is blank, secretId={}, config={}!",
622-
this.callerId, this.clientConfig.getAuthSecretId(), queryResult.getF1());
621+
logger.warn("ConfigManager({}) config failure: username is blank, userName={}, config={}!",
622+
this.callerId, this.clientConfig.getUserName(), queryResult.getF1());
623623
}
624624
throw new Exception("username is blank!");
625625
}
626626
String versionStr = resultData.get("version").getAsString();
627627
if (StringUtils.isBlank(versionStr)) {
628628
if (parseCounter.shouldPrint()) {
629-
logger.warn("ConfigManager({}) config failure: version is blank, secretId={}, config={}!",
630-
this.callerId, this.clientConfig.getAuthSecretId(), queryResult.getF1());
629+
logger.warn("ConfigManager({}) config failure: version is blank, userName={}, config={}!",
630+
this.callerId, this.clientConfig.getUserName(), queryResult.getF1());
631631
}
632632
throw new Exception("version is blank!");
633633
}
@@ -670,8 +670,8 @@ private Tuple2<EncryptConfigEntry, String> readCachedPubKeyEntry() {
670670
}
671671
} catch (Throwable ex) {
672672
if (exptCounter.shouldPrint()) {
673-
logger.warn("ConfigManager({}) read({}) file exception, secretId={}",
674-
callerId, encryptConfigCacheFile, clientConfig.getAuthSecretId(), ex);
673+
logger.warn("ConfigManager({}) read({}) file exception, userName={}",
674+
callerId, encryptConfigCacheFile, clientConfig.getUserName(), ex);
675675
}
676676
return new Tuple2<>(null, "read PubKeyEntry file failure:" + ex.getMessage());
677677
} finally {
@@ -705,8 +705,8 @@ private void writeCachePubKeyEntryFile(EncryptConfigEntry entry) {
705705
// p.close();
706706
} catch (Throwable ex) {
707707
if (exptCounter.shouldPrint()) {
708-
logger.warn("ConfigManager({}) write file({}) exception, secretId={}, content={}",
709-
callerId, encryptConfigCacheFile, clientConfig.getAuthSecretId(), entry.toString(), ex);
708+
logger.warn("ConfigManager({}) write file({}) exception, userName={}, content={}",
709+
callerId, encryptConfigCacheFile, clientConfig.getUserName(), entry.toString(), ex);
710710
}
711711
} finally {
712712
if (fos != null) {
@@ -836,7 +836,7 @@ private void storeAndBuildMetaConfigure(ProxyClientConfig config) {
836836
this.encryptConfigCacheFile = strBuff
837837
.append(clientConfig.getConfigStoreBasePath())
838838
.append(ConfigConstants.META_STORE_SUB_DIR)
839-
.append(clientConfig.getAuthSecretId())
839+
.append(clientConfig.getUserName())
840840
.append(ConfigConstants.REMOTE_ENCRYPT_CACHE_FILE_SUFFIX)
841841
.toString();
842842
strBuff.delete(0, strBuff.length());

inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/metric/MetricConfig.java

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

1818
package org.apache.inlong.sdk.dataproxy.metric;
1919

20-
import org.apache.commons.lang.StringUtils;
20+
import org.apache.commons.lang3.StringUtils;
2121

2222
public class MetricConfig {
2323

inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/network/ClientMgr.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import io.netty.channel.ChannelOption;
3434
import io.netty.channel.EventLoopGroup;
3535
import io.netty.util.concurrent.DefaultThreadFactory;
36-
import org.apache.commons.lang.mutable.MutableBoolean;
36+
import org.apache.commons.lang3.mutable.MutableBoolean;
3737
import org.slf4j.Logger;
3838
import org.slf4j.LoggerFactory;
3939

@@ -322,6 +322,9 @@ public void updateProxyInfoList(boolean nodeChanged, List<HostInfo> newNodes) {
322322
do {
323323
int selectCnt = 0;
324324
for (HostInfo hostInfo : candidateNodes) {
325+
if (realHosts.contains(hostInfo.getReferenceName())) {
326+
continue;
327+
}
325328
try {
326329
client = new NettyClient(this.sender.getInstanceId(),
327330
this.bootstrap, hostInfo, this.configure);

inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/network/Sender.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
import org.apache.inlong.sdk.dataproxy.utils.Tuple2;
2929

3030
import io.netty.channel.Channel;
31-
import org.apache.commons.lang.mutable.MutableBoolean;
3231
import org.apache.commons.lang3.StringUtils;
32+
import org.apache.commons.lang3.mutable.MutableBoolean;
3333
import org.slf4j.Logger;
3434
import org.slf4j.LoggerFactory;
3535

inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/pb/config/ContextProxyClusterConfigLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.apache.inlong.sdk.dataproxy.pb.config.pojo.ProxyInfo;
2424

2525
import com.alibaba.fastjson.JSON;
26-
import org.apache.commons.lang.StringUtils;
26+
import org.apache.commons.lang3.StringUtils;
2727
import org.apache.flume.Context;
2828
import org.slf4j.Logger;
2929
import org.slf4j.LoggerFactory;

0 commit comments

Comments
 (0)