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