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