mirror of
https://gitee.com/BDWare/cm
synced 2025-01-26 09:44:03 +00:00
merge
This commit is contained in:
parent
9876ccc2e2
commit
5b4221dd29
@ -890,6 +890,7 @@ public class ContractManager {
|
|||||||
case RequestAllResponseHalf:
|
case RequestAllResponseHalf:
|
||||||
case Sharding:
|
case Sharding:
|
||||||
case Sole:
|
case Sole:
|
||||||
|
case SelfAdaptiveSharding:
|
||||||
case PBFT:
|
case PBFT:
|
||||||
ret = client.startProcess(ps);
|
ret = client.startProcess(ps);
|
||||||
conflictCheck = checkConflict(c, client, ret);
|
conflictCheck = checkConflict(c, client, ret);
|
||||||
@ -1475,7 +1476,7 @@ public class ContractManager {
|
|||||||
LOGGER.debug(
|
LOGGER.debug(
|
||||||
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
|
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
|
||||||
.format(new Date(System.currentTimeMillis()))
|
.format(new Date(System.currentTimeMillis()))
|
||||||
+ meta.contractExecutor + " 结果是 "
|
+ meta.contractExecutor + " result="
|
||||||
+ result.toString()
|
+ result.toString()
|
||||||
+ "\n");
|
+ "\n");
|
||||||
rcb.onResult(result);
|
rcb.onResult(result);
|
||||||
|
@ -16,6 +16,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
public class ContractMeta implements IDSerializable {
|
public class ContractMeta implements IDSerializable {
|
||||||
public Contract contract;
|
public Contract contract;
|
||||||
|
public transient ContractExecutor contractExecutor;
|
||||||
ContractStatusEnum status;
|
ContractStatusEnum status;
|
||||||
String name;
|
String name;
|
||||||
String id;
|
String id;
|
||||||
@ -26,8 +27,6 @@ public class ContractMeta implements IDSerializable {
|
|||||||
List<AnnotationNode> annotations;
|
List<AnnotationNode> annotations;
|
||||||
Set<String> dependentContracts;
|
Set<String> dependentContracts;
|
||||||
transient Map<String, FunctionDesp> funCache;
|
transient Map<String, FunctionDesp> funCache;
|
||||||
public transient ContractExecutor contractExecutor;
|
|
||||||
|
|
||||||
boolean sigRequired;
|
boolean sigRequired;
|
||||||
String thisPermission; // 合约当前权限
|
String thisPermission; // 合约当前权限
|
||||||
/*
|
/*
|
||||||
@ -101,12 +100,17 @@ public class ContractMeta implements IDSerializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FunctionDesp getExportedFunction(String action) {
|
public FunctionDesp getExportedFunction(String action) {
|
||||||
if (funCache == null) funCache = new HashMap<>();
|
FunctionDesp ret;
|
||||||
FunctionDesp desp = funCache.get(action);
|
if (null == funCache) {
|
||||||
if (desp != null) return desp;
|
funCache = new HashMap<>();
|
||||||
desp = seekFunction(action);
|
}
|
||||||
if (desp != null) funCache.put(action, desp);
|
if (!funCache.containsKey(action)) {
|
||||||
return desp;
|
ret = seekFunction(action);
|
||||||
|
funCache.put(action, ret);
|
||||||
|
} else {
|
||||||
|
ret = funCache.get(action);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private FunctionDesp seekFunction(String action) {
|
private FunctionDesp seekFunction(String action) {
|
||||||
|
@ -10,7 +10,7 @@ public interface ContractExecutor {
|
|||||||
|
|
||||||
default void close() {
|
default void close() {
|
||||||
}
|
}
|
||||||
default void onSyncMessage(Node node, byte[] data) {
|
|
||||||
|
|
||||||
|
default void onSyncMessage(Node node, byte[] data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,11 @@ import org.bdware.sc.conn.ResultCallback;
|
|||||||
public class SingleNodeExecutor implements ContractExecutor {
|
public class SingleNodeExecutor implements ContractExecutor {
|
||||||
public static SingleNodeExecutor instance = new SingleNodeExecutor();
|
public static SingleNodeExecutor instance = new SingleNodeExecutor();
|
||||||
private ContractManager cm;
|
private ContractManager cm;
|
||||||
|
|
||||||
public static void setContractManager(ContractManager cm) {
|
public static void setContractManager(ContractManager cm) {
|
||||||
instance.cm = cm;
|
instance.cm = cm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String requestID, ContractRequest req, ResultCallback rcb, OnHashCallback hcb) {
|
public void execute(String requestID, ContractRequest req, ResultCallback rcb, OnHashCallback hcb) {
|
||||||
cm.executeLocallyAsync(req, rcb, hcb);
|
cm.executeLocallyAsync(req, rcb, hcb);
|
||||||
|
Loading…
Reference in New Issue
Block a user