update docker files

This commit is contained in:
CaiHQ 2024-12-23 16:19:11 +08:00
parent 8e07feb733
commit cdf94fc50d
2 changed files with 37 additions and 31 deletions

View File

@ -133,21 +133,24 @@ public class ContractClient {
}
private void initProps() {
// LOGGER.info("initProps ---- position-----1");
LOGGER.info("initProps ---- position-----1");
contractMeta.name = get.syncGet("", "getContractName", "");
// LOGGER.info("initProps ---- position-----2");
LOGGER.info("initProps ---- position-----2");
String strEvent = get.syncGet("", "getDeclaredEvents", "");
LOGGER.debug("event: " + strEvent);
contractMeta.declaredEvents = JsonUtil.fromJson(strEvent,
new TypeToken<Map<String, REventSemantics>>() {}.getType());
// LOGGER.info("initProps ---- position-----3");
new TypeToken<Map<String, REventSemantics>>() {
}.getType());
LOGGER.info("initProps ---- position-----3");
contractMeta.dependentContracts =
JsonUtil.fromJson(get.syncGet("", "getDependentContracts", ""),
new TypeToken<Set<String>>() {}.getType());
// LOGGER.info("initProps ---- position-----4");
new TypeToken<Set<String>>() {
}.getType());
LOGGER.info("initProps ---- position-----4");
contractMeta.exportedFunctions =
JsonUtil.fromJson(get.syncGet("", "getExportedFunctions", ""),
new TypeToken<List<FunctionDesp>>() {}.getType());
new TypeToken<List<FunctionDesp>>() {
}.getType());
contractMeta.logDetail = new HashMap<>();
for (FunctionDesp func : contractMeta.exportedFunctions) {
StringBuilder str = new StringBuilder();
@ -172,24 +175,25 @@ public class ContractClient {
}
contractMeta.logDetail.put(func.functionName, str.toString());
}
// LOGGER.info("initProps ---- position-----5");
LOGGER.info("initProps ---- position-----5");
try {
String anno = get.syncGet("", "getAnnotations", "");
contractMeta.annotations =
JsonUtil.fromJson(anno, new TypeToken<List<AnnotationNode>>() {}.getType());
JsonUtil.fromJson(anno, new TypeToken<List<AnnotationNode>>() {
}.getType());
} catch (Exception e) {
// supoort contract process before version 0.70
contractMeta.annotations = new ArrayList<>();
}
// LOGGER.info("initProps ---- position-----6");
LOGGER.info("initProps ---- position-----6");
contractMeta.sigRequired = Boolean.parseBoolean(get.syncGet("", "isSigRequired", ""));
// LOGGER.info("initProps ---- position-----7");
LOGGER.info("initProps ---- position-----7");
contractMeta.thisPermission = get.syncGet("", "showPermission", "");
// LOGGER.info("initProps ---- position-----8");
LOGGER.info("initProps ---- position-----8");
isRunning = true;
// LOGGER.info("initProps ---- position-----9");
LOGGER.info("initProps ---- position-----9");
get.syncGet("", "registerMangerPort", ContractManager.cPort.getCMPort() + "");
contractMeta.contract =
JsonUtil.fromJson(get.syncGet("", "getContract", ""), Contract.class);
@ -204,8 +208,7 @@ public class ContractClient {
}
});
loadTimesAndTraffic();
// LOGGER.info("initProps ---- position-----10");
// LOGGER.debug("======= registerPort:" + ret + "-->" + ContractManager.startPort);
LOGGER.info("initProps ---- position-----10 DONE!");
}
public String startProcess(PrintStream ps) throws Exception {
@ -262,7 +265,7 @@ public class ContractClient {
pbParameters.toArray(result);
Constructor<ProcessBuilder> 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());
@ -335,7 +338,7 @@ public class ContractClient {
} else {
status = get.syncGet("", "setContract", JsonUtil.toJson(contractMeta.contract));
}
LOGGER.debug("port:" + port + " status:" + status);
LOGGER.info("start status, port:" + port + " status:" + status);
ContractResult r = JsonUtil.fromJson(status, ContractResult.class);
if (r.status == Status.Success) {
initProps();

View File

@ -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++) {
@ -404,7 +404,9 @@ public class ContractManager {
c.setType(ContractExecType.Sole);
SM2KeyPair pair = SM2Util.generateSM2KeyPair();
c.setOwner(pair.getPublicKeyStr());
c.setScript("contract analysis_client{}");
String content = "contract analysis_client{}";
c.setID(content.hashCode() + "");
c.setScript(content);
analysisClient = new ContractClient(c);
try {
analysisClient.startProcess(System.out);
@ -1800,7 +1802,8 @@ public class ContractManager {
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);