mirror of
https://gitee.com/BDWare/cm
synced 2025-01-25 01:04:04 +00:00
fix contract client missing log bugs
This commit is contained in:
parent
630bb2eb7e
commit
6cd99cf17a
@ -253,10 +253,11 @@ public class ContractClient {
|
||||
if (contractMeta.contract.getRemoteDebugPort() != 0) {
|
||||
pbParameters.add(String.format("-agentlib:jdwp=transport=dt_socket,address=%d,server=y,suspend=n", contractMeta.contract.getRemoteDebugPort()));
|
||||
}
|
||||
File classParent = new File(classpath).getParentFile();
|
||||
if (contractMeta.contract.isDebug()) {
|
||||
pbParameters.add("-Dlog4j.configurationFile=./log4j2.debug.properties");
|
||||
pbParameters.add("-Dlog4j.configurationFile=" + new File(classParent, "log4j2.debug.properties").getAbsolutePath());
|
||||
} else {
|
||||
pbParameters.add("-Dlog4j.configurationFile=./log4j2.properties");
|
||||
pbParameters.add("-Dlog4j.configurationFile=" + new File(classParent, "log4j2.properties").getAbsolutePath());
|
||||
}
|
||||
pbParameters.add("-jar");
|
||||
pbParameters.add(classpath);
|
||||
@ -269,6 +270,7 @@ public class ContractClient {
|
||||
pbParameters.toArray(result);
|
||||
Constructor<ProcessBuilder> pbc = ProcessBuilder.class.getDeclaredConstructor(String[].class);
|
||||
builder = pbc.newInstance(new Object[]{result});
|
||||
|
||||
File directory = new File("./");
|
||||
LOGGER.debug("[CMD] path: " + directory.getAbsolutePath());
|
||||
LOGGER.debug(JsonUtil.toPrettyJson(builder.command()));
|
||||
|
@ -973,6 +973,7 @@ public class ContractManager {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void setContractStateful(Contract c) {
|
||||
ContractManifest cm = YJSPacker.getManifest(c.getScriptStr());
|
||||
if (cm != null && cm.stateful != null && cm.stateful.equals("false")) {
|
||||
@ -1770,6 +1771,7 @@ public class ContractManager {
|
||||
|
||||
public String loadMemory(ContractClient client, String path) {
|
||||
if (client == null) return "no such contract client";
|
||||
if (path == null || path.length() == 0) return "no such memory file";
|
||||
addLocalContractLog("loadMemory", client.contractMeta);
|
||||
return client.get.syncGet("", "loadMemory", path);
|
||||
}
|
||||
|
@ -360,11 +360,9 @@ public class ContractStatusRecorder extends StatusRecorder<ContractMeta> {
|
||||
// 可增加一个判断,如果hanged朋manifest里是加载memory,这里就不再加载了。
|
||||
ContractClient client = id2ContractClient.get(meta.getID());
|
||||
if (preStatus == ContractStatusEnum.HANGED) {
|
||||
|
||||
ContractManager.instance.loadMemory(
|
||||
client, ContractManager.instance.findNewestMemory(meta.name));
|
||||
|
||||
|
||||
String memory = ContractManager.instance.findNewestMemory(meta.name);
|
||||
if (memory != null)
|
||||
ContractManager.instance.loadMemory(client, memory);
|
||||
}
|
||||
client.contractMeta.setStatus(ContractStatusEnum.RUNNING);
|
||||
updateValue(client.contractMeta);
|
||||
|
Loading…
Reference in New Issue
Block a user