mirror of
https://gitee.com/BDWare/common
synced 2025-01-25 01:04:16 +00:00
feat: more default router function
This commit is contained in:
parent
4ef2806c20
commit
e336865cc1
@ -45,10 +45,8 @@ public class ComponedContractResult {
|
||||
LOGGER.info("加入一个节点的执行结果是Error!该节点下线!");
|
||||
return;
|
||||
}
|
||||
|
||||
ContractResult cr2;
|
||||
try {
|
||||
|
||||
cr2 = JsonUtil.fromJson(obj.get("data").getAsString(), ContractResult.class);
|
||||
if (cr2.status == ContractResult.Status.Error
|
||||
&& cr2.result.getAsString().equals(EXPIRED_REQ)) {
|
||||
@ -122,7 +120,7 @@ public class ComponedContractResult {
|
||||
}
|
||||
|
||||
public ContractResult mergeFinalResult() {
|
||||
LOGGER.info("mergeFinalResult");
|
||||
// LOGGER.info("mergeFinalResult");
|
||||
|
||||
Map<JsonElement, Integer> map = new ConcurrentHashMap<>(); // <结果,出现次数>
|
||||
|
||||
|
@ -165,13 +165,12 @@ public class SocketGet {
|
||||
|
||||
public void asyncGet(String pkgName, String method, String arg, ResultCallback cb) {
|
||||
try {
|
||||
long id = random.nextLong();
|
||||
if (!r.waitObj.containsKey(id) && null != cb) {
|
||||
long id;
|
||||
for (id = random.nextLong(); r.waitObj.containsKey(id); id = random.nextLong()) ;
|
||||
if (cb != null) {
|
||||
r.waitObj.put(id, cb);
|
||||
} else {
|
||||
LOGGER.warn("id conflict! " + id);
|
||||
r.sleep(id, cb);
|
||||
}
|
||||
r.sleep(id, cb);
|
||||
request(pkgName, method, arg, id);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -1,8 +1,5 @@
|
||||
package org.bdware.sc.bean;
|
||||
|
||||
public enum DefaultRouteRule {
|
||||
byRequester,
|
||||
byArgHash,
|
||||
byTarget,
|
||||
byFunc;
|
||||
byRequester, byArgHash, byJsonPropHash, byShardingIDTree, byFunc;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ public class RouteInfo implements Serializable {
|
||||
// The signature of RouteFunction is
|
||||
// function myFunc(requester, sourceArg)
|
||||
public String funcName;
|
||||
public String param;
|
||||
|
||||
public static RouteInfo create(AnnotationNode annotationNode, ContractNode contractNode) {
|
||||
RouteInfo info = new RouteInfo();
|
||||
|
Loading…
Reference in New Issue
Block a user