Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix:通过前置服务的API启动和关闭群组的异常 #857

Open
13813385093 opened this issue Jul 4, 2023 · 0 comments
Open

bugfix:通过前置服务的API启动和关闭群组的异常 #857

13813385093 opened this issue Jul 4, 2023 · 0 comments

Comments

@13813385093
Copy link

13813385093 commented Jul 4, 2023

关闭节点所属的全部群组以后,无法再启动的问题。应该是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;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant