-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Description
关闭节点所属的全部群组以后,无法再启动的问题。应该是getWeb3j接口调用底层SDK缓存造成的问题,可以直接使用Spring注入的rpcLient类,无需通过群组进行遍历后再创建新的Client对象
com.webank.webase.front.web3api.Web3ApiService
/**
- get first web3j in web3jMap
- @return
*/
public Client getWeb3j() {
this.checkConnection();
Set groupIdSet = bcosSDK.getGroupManagerService().getGroupList(); //1
log.info("getWeb3j groupIdSet get {}", groupIdSet);
if (groupIdSet.isEmpty()) {
log.error("web3jMap is empty, groupList empty! please check your node status");
// get default web3j of integer max value
return rpcWeb3j;
}
// get random index to get web3j
Client client = null;
for (Integer groupId : groupIdSet) {
try {
client = bcosSDK.getClient(groupId);
} catch (BcosSDKException ex) {
log.error("getClient failed groupId:{}, ex", groupId, ex);
}
if (client != null) {
return client;
}
}
log.warn("getWeb3j finally get null, now return rpcWeb3j");
return rpcWeb3j;
}
Metadata
Metadata
Assignees
Labels
No labels