mirror of
https://gitee.com/BDWare/cm
synced 2025-01-10 01:44:04 +00:00
update doip-sdk
This commit is contained in:
parent
fc453d56fc
commit
f53c2374df
@ -445,7 +445,6 @@ public class ContractManager {
|
||||
}
|
||||
|
||||
public ContractClient getContractClientByDoi(String doi) {
|
||||
|
||||
ContractMeta meta = statusRecorder.getContractMeta(doi);
|
||||
return statusRecorder.getContractClient(meta.id);
|
||||
}
|
||||
|
@ -79,10 +79,8 @@ public class EventRecorder {
|
||||
String key = KeyValueRocksDBUtil.instance.getValue(dbName, LATEST_EVENT_KEY);
|
||||
latestEvent.set(key);
|
||||
CheckPoint cp = new CheckPoint();
|
||||
Type topic2cIdsType = TypeToken
|
||||
.getParameterized(ConcurrentHashMap.class, String.class,
|
||||
TypeToken.getParameterized(Set.class, String.class, String.class).getType())
|
||||
.getType();
|
||||
Type topic2cIdsType = TypeToken.getParameterized(ConcurrentHashMap.class, String.class,
|
||||
TypeToken.getParameterized(Set.class, String.class).getType()).getType();
|
||||
// retrieving transactions from database
|
||||
while (null != key && !key.isEmpty()) {
|
||||
String json = KeyValueRocksDBUtil.instance.getValue(dbName, key);
|
||||
@ -94,16 +92,14 @@ public class EventRecorder {
|
||||
if (json.startsWith("cp")) {
|
||||
// create check point by the transaction and stop retrieving
|
||||
JsonObject data = JsonUtil.parseStringAsJsonObject(json.substring(2));
|
||||
cp.topic2cIds =
|
||||
JsonUtil.fromJson(data.get("topic2cIds").toString(), topic2cIdsType);
|
||||
cp.topic2cIds = JsonUtil.fromJson(data.get("topic2cIds").toString(), topic2cIdsType);
|
||||
JsonObject id2Consumers = data.getAsJsonObject("id2Consumers");
|
||||
for (String k : id2Consumers.keySet()) {
|
||||
JsonObject consumer = id2Consumers.getAsJsonObject(k);
|
||||
if (!consumer.has("type")) {
|
||||
continue;
|
||||
}
|
||||
ConsumerType type =
|
||||
ConsumerType.valueOf(consumer.get("type").getAsString());
|
||||
ConsumerType type = ConsumerType.valueOf(consumer.get("type").getAsString());
|
||||
switch (type) {
|
||||
case Contract:
|
||||
cp.id2Consumers.put(k,
|
||||
@ -148,8 +144,7 @@ public class EventRecorder {
|
||||
// if empty, return the check point
|
||||
latestEvent.setCp(true);
|
||||
} else {
|
||||
// on the base of old check point, process following sub or unsub events to recover
|
||||
// registry
|
||||
// on the base of old check point, process following sub or unsub events to recover registry
|
||||
while (!stack.empty()) {
|
||||
Object record = stack.pop();
|
||||
if (record instanceof CheckPoint) {
|
||||
@ -159,19 +154,15 @@ public class EventRecorder {
|
||||
IEventConsumer consumer = broker.parseConsumer(tran.content);
|
||||
switch (tran.type) {
|
||||
case SUBSCRIBE:
|
||||
if (!broker.subInReg(tran.topic, consumer, cp.topic2cIds,
|
||||
cp.id2Consumers)) {
|
||||
if (!broker.subInReg(tran.topic, consumer, cp.topic2cIds, cp.id2Consumers)) {
|
||||
LOGGER.warn("record damaged! " + key);
|
||||
LOGGER.debug(
|
||||
"record damaged! " + key + ": " + JsonUtil.toJson(tran));
|
||||
LOGGER.debug("record damaged! " + key + ": " + JsonUtil.toJson(tran));
|
||||
}
|
||||
break;
|
||||
case UNSUBSCRIBE:
|
||||
if (!broker.unsubInReg(tran.topic, consumer, cp.topic2cIds,
|
||||
cp.id2Consumers)) {
|
||||
if (!broker.unsubInReg(tran.topic, consumer, cp.topic2cIds, cp.id2Consumers)) {
|
||||
LOGGER.warn("record damaged! " + key);
|
||||
LOGGER.debug(
|
||||
"record damaged! " + key + ": " + JsonUtil.toJson(tran));
|
||||
LOGGER.debug("record damaged! " + key + ": " + JsonUtil.toJson(tran));
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user