mirror of
https://gitee.com/BDWare/agent-backend
synced 2025-01-09 17:34:13 +00:00
test action: prune killed Contract
This commit is contained in:
parent
fc7512f50f
commit
f3f146b30a
@ -7,6 +7,7 @@ import org.bdware.sc.*;
|
||||
import org.bdware.sc.bean.Contract;
|
||||
import org.bdware.sc.bean.ContractExecType;
|
||||
import org.bdware.sc.conn.ResultCallback;
|
||||
import org.bdware.sc.units.MultiContractMeta;
|
||||
import org.bdware.sc.util.JsonUtil;
|
||||
import org.bdware.server.GlobalConf;
|
||||
import org.bdware.server.action.p2p.MasterServerRecoverMechAction;
|
||||
@ -175,6 +176,25 @@ public class TemporyTestAction {
|
||||
resultCallback.onResult(jo.toString());
|
||||
}
|
||||
|
||||
@Action(async = true)
|
||||
public void pruneKilledContract(JsonObject args, ResultCallback resultCallback) {
|
||||
Map<String, ContractMeta> map = CMActions.manager.statusRecorder.getStatus();
|
||||
LOGGER.info("pruneKilledContract!!!");
|
||||
Set<ContractMeta> toRemove = new HashSet<>();
|
||||
for (ContractMeta meta : map.values()) {
|
||||
if (meta.getStatus().equals(ContractStatusEnum.KILLED))
|
||||
toRemove.add(meta);
|
||||
}
|
||||
LOGGER.info("pruneKilledContract!!! size:" + toRemove.size());
|
||||
for (ContractMeta key : toRemove) {
|
||||
CMActions.manager.statusRecorder.remove(key);
|
||||
MultiContractMeta multiMeta = CMActions.manager.multiContractRecorder.getMultiContractMeta(key.getID());
|
||||
CMActions.manager.multiContractRecorder.remove(multiMeta);
|
||||
}
|
||||
resultCallback.onResult("size:" + toRemove.size());
|
||||
|
||||
}
|
||||
|
||||
@Action(async = true)
|
||||
public void reconnectPort(JsonObject args, ResultCallback resultCallback) {
|
||||
ContractPort.PortVisitor reconnectVisitor = CMActions.manager.statusRecorder.getVisitor();
|
||||
|
12
src/main/java/org/bdware/server/executor/Context.java
Normal file
12
src/main/java/org/bdware/server/executor/Context.java
Normal file
@ -0,0 +1,12 @@
|
||||
package org.bdware.server.executor;
|
||||
|
||||
import org.bdware.sc.conn.ResultCallback;
|
||||
|
||||
public interface Context {
|
||||
|
||||
public String[] getMembers(String contractID);
|
||||
|
||||
public void sendToAgent(String pubkey, String content);
|
||||
|
||||
public void sleepWithTimeout(final String requestID, ResultCallback cb, int timeOut);
|
||||
}
|
Loading…
Reference in New Issue
Block a user