From 8efc164d9996c9384df2acbd2a3aeae2b3ad927d Mon Sep 17 00:00:00 2001 From: CaiHQ Date: Mon, 23 Dec 2024 16:21:45 +0800 Subject: [PATCH] update logs --- .../java/org/bdware/sc/ContractClient.java | 16 +++++------- .../java/org/bdware/sc/ContractManager.java | 25 +++++++++---------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/src/main/java/org/bdware/sc/ContractClient.java b/src/main/java/org/bdware/sc/ContractClient.java index ac179d3..4812348 100644 --- a/src/main/java/org/bdware/sc/ContractClient.java +++ b/src/main/java/org/bdware/sc/ContractClient.java @@ -139,18 +139,15 @@ public class ContractClient { String strEvent = get.syncGet("", "getDeclaredEvents", ""); LOGGER.debug("event: " + strEvent); contractMeta.declaredEvents = JsonUtil.fromJson(strEvent, - new TypeToken>() { - }.getType()); + new TypeToken>() {}.getType()); LOGGER.info("initProps ---- position-----3"); contractMeta.dependentContracts = JsonUtil.fromJson(get.syncGet("", "getDependentContracts", ""), - new TypeToken>() { - }.getType()); + new TypeToken>() {}.getType()); LOGGER.info("initProps ---- position-----4"); contractMeta.exportedFunctions = JsonUtil.fromJson(get.syncGet("", "getExportedFunctions", ""), - new TypeToken>() { - }.getType()); + new TypeToken>() {}.getType()); contractMeta.logDetail = new HashMap<>(); for (FunctionDesp func : contractMeta.exportedFunctions) { StringBuilder str = new StringBuilder(); @@ -180,8 +177,7 @@ public class ContractClient { String anno = get.syncGet("", "getAnnotations", ""); contractMeta.annotations = - JsonUtil.fromJson(anno, new TypeToken>() { - }.getType()); + JsonUtil.fromJson(anno, new TypeToken>() {}.getType()); } catch (Exception e) { // supoort contract process before version 0.70 @@ -265,7 +261,7 @@ public class ContractClient { pbParameters.toArray(result); Constructor pbc = ProcessBuilder.class.getDeclaredConstructor(String[].class); - builder = pbc.newInstance(new Object[]{result}); + builder = pbc.newInstance(new Object[] {result}); File directory = new File("./"); LOGGER.debug("[CMD] path: " + directory.getAbsolutePath()); @@ -330,7 +326,7 @@ public class ContractClient { } else { LOGGER.info("setMember ignore, meta:" + (multiContractMeta == null) + (multiContractMeta == null ? "NULL" - : " members:" + multiContractMeta.getMembers())); + : " members:" + multiContractMeta.getMembers())); } if (isBundlePath(contractMeta.contract.getScriptStr())) { diff --git a/src/main/java/org/bdware/sc/ContractManager.java b/src/main/java/org/bdware/sc/ContractManager.java index 26b6a4f..2d4d928 100644 --- a/src/main/java/org/bdware/sc/ContractManager.java +++ b/src/main/java/org/bdware/sc/ContractManager.java @@ -104,7 +104,7 @@ public class ContractManager { } private static String convertToBytes(long traffic) { - String[] unit = new String[]{"B", "KB", "MB", "GB", "TB"}; + String[] unit = new String[] {"B", "KB", "MB", "GB", "TB"}; double d = traffic; int i; for (i = 0; i < unit.length - 1; i++) { @@ -368,7 +368,7 @@ public class ContractManager { } public static void checkPointToLedger(OnHashCallback cb, String contractID, String data, - String requestID) { + String requestID) { boolean isMaster = instance.getContractIsMaster(contractID); if (!isMaster) { LOGGER.info("非合约 " + contractID + "的master,无需承担checkPoint上链任务!"); @@ -898,8 +898,8 @@ public class ContractManager { config.setMockConfig(mockYPK); // client.setProjectConfig(JsonUtil.toJson(config)); } // else { - // bubian - // } + // bubian + // } } } @@ -1182,7 +1182,7 @@ public class ContractManager { } private void executeInternalAsync(ContractClient client, ContractRequest request, - ResultCallback rcb, OnHashCallback cb) { + ResultCallback rcb, OnHashCallback cb) { ContractResult cr; long start = System.currentTimeMillis(); @@ -1223,7 +1223,7 @@ public class ContractManager { } private String executeInternal(ContractClient client, ContractRequest request, - OnHashCallback ocb) { + OnHashCallback ocb) { // LOGGER.info("ContractManager executeInternal : "); ContractResult cr; @@ -1254,7 +1254,7 @@ public class ContractManager { * @author Kaidong Wu */ public void extractEventsFromContractResult(OnHashCallback ocb, JsonObject result, - ContractClient client, ContractRequest request, long startTime) { + ContractClient client, ContractRequest request, long startTime) { try { ContractResult cr = JsonUtil.fromJson(result, ContractResult.class); if (null != cr.events && !cr.events.isEmpty()) { @@ -1305,7 +1305,7 @@ public class ContractManager { } public void executeContractInternal(ContractRequest cr, final ResultCallback rcb, - final OnHashCallback hcb) { + final OnHashCallback hcb) { LOGGER.debug(JsonUtil.toJson(cr)); ContractMeta meta = statusRecorder.getContractMeta(cr.getContractID()); MultiContractMeta multiMeta = @@ -1795,15 +1795,14 @@ public class ContractManager { */ public void addLocalContractLog(String action, String contractId, String contractName, - String pubKey) { + String pubKey) { String sb = "{\"action\":\"" + action + "\",\"pubKey\":\"" + pubKey + "\",\"contractID\":\"" + contractId + "\",\"contractName\":\"" + contractName + "\",\"date\":" + System.currentTimeMillis() + "}"; logsDB.put(contractName, sb); } - public void changePermission(String contractFileName, String pmList) { - } + public void changePermission(String contractFileName, String pmList) {} // public String getSyncType(String contractName) { // ContractClient client = getByName(contractName); @@ -1854,8 +1853,8 @@ public class ContractManager { // } public void addLocalContractLog(String action, String contractId, String contractName, - String pubKey, String function, String costTime, long totalGas, long executionGas, - long extraGas, Map logType) { + String pubKey, String function, String costTime, long totalGas, long executionGas, + long extraGas, Map logType) { contractCounter.inc(); if (logType == null || logType.isEmpty()) { logsDB.put(contractName,