mirror of
https://gitee.com/BDWare/agent-backend
synced 2025-01-10 09:54:11 +00:00
feat: update SelfAdaptiveShardingExecutor
add logs in SelfAdaptiveShardingExecutor
This commit is contained in:
parent
4423af8d1c
commit
aba4d8dad3
@ -47,8 +47,11 @@ public class SelfAdaptiveShardingExecutor implements ContractExecutor {
|
|||||||
2,
|
2,
|
||||||
TimeUnit.SECONDS);
|
TimeUnit.SECONDS);
|
||||||
ContractManager.threadPool.submit(() -> {
|
ContractManager.threadPool.submit(() -> {
|
||||||
|
LOGGER.warn(
|
||||||
|
"[SelfAdaptiveShardingExecutor " + meta.getContractID() + "] starting service...");
|
||||||
while (running) {
|
while (running) {
|
||||||
LOGGER.debug("latest block=" + this.b.prevHash + ", to be executed size=" + toExecuted.size());
|
LOGGER.info("checking blocks to be executed, latest block=" +
|
||||||
|
this.b.prevHash + ", to be executed size=" + toExecuted.size());
|
||||||
LOGGER.debug("executed: " + JsonUtil.toJson(executedBlocks) + "\n\t" + JsonUtil.toJson(executedTxs));
|
LOGGER.debug("executed: " + JsonUtil.toJson(executedBlocks) + "\n\t" + JsonUtil.toJson(executedTxs));
|
||||||
while (!toExecuted.isEmpty()) {
|
while (!toExecuted.isEmpty()) {
|
||||||
String key = this.b.prevHash;
|
String key = this.b.prevHash;
|
||||||
@ -75,6 +78,7 @@ public class SelfAdaptiveShardingExecutor implements ContractExecutor {
|
|||||||
public void close() {
|
public void close() {
|
||||||
this.future.cancel(false);
|
this.future.cancel(false);
|
||||||
this.running = false;
|
this.running = false;
|
||||||
|
LOGGER.info("destruct executor of contract " + meta.getContractID());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -128,6 +132,11 @@ public class SelfAdaptiveShardingExecutor implements ContractExecutor {
|
|||||||
LOGGER.debug("result of request " + request.getRequestID() + ": " + ret);
|
LOGGER.debug("result of request " + request.getRequestID() + ": " + ret);
|
||||||
executedTxs.put(request.getRequestID(), true);
|
executedTxs.put(request.getRequestID(), true);
|
||||||
}
|
}
|
||||||
|
LOGGER.info(String.format(
|
||||||
|
"[SelfAdaptiveShardingExecutor %s] execute %d transactions of block %s",
|
||||||
|
meta.getContractID(),
|
||||||
|
block.requests.length,
|
||||||
|
block.hash));
|
||||||
this.b = new Block(block.hash);
|
this.b = new Block(block.hash);
|
||||||
executedBlocks.add(block.hash);
|
executedBlocks.add(block.hash);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user