WeBASE-Front
WeBASE-Front copied to clipboard
bugfix:通过前置服务的API启动和关闭群组的异常
关闭节点所属的全部群组以后,无法再启动的问题。应该是getWeb3j接口调用底层SDK缓存造成的问题,可以直接使用Spring注入的rpcLient类,无需通过群组进行遍历后再创建新的Client对象
com.webank.webase.front.web3api.Web3ApiService
/**
- get first web3j in web3jMap
- @return */ public Client getWeb3j() { this.checkConnection(); Set<Integer> 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; }