feat: update SelfAdaptiveShardingExecutor

add logs in SelfAdaptiveShardingExecutor
This commit is contained in:
Frank.R.Wu 2021-11-17 21:25:48 +08:00
parent 4423af8d1c
commit aba4d8dad3

View File

@ -47,8 +47,11 @@ public class SelfAdaptiveShardingExecutor implements ContractExecutor {
2,
TimeUnit.SECONDS);
ContractManager.threadPool.submit(() -> {
LOGGER.warn(
"[SelfAdaptiveShardingExecutor " + meta.getContractID() + "] starting service...");
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));
while (!toExecuted.isEmpty()) {
String key = this.b.prevHash;
@ -75,6 +78,7 @@ public class SelfAdaptiveShardingExecutor implements ContractExecutor {
public void close() {
this.future.cancel(false);
this.running = false;
LOGGER.info("destruct executor of contract " + meta.getContractID());
}
@Override
@ -128,6 +132,11 @@ public class SelfAdaptiveShardingExecutor implements ContractExecutor {
LOGGER.debug("result of request " + request.getRequestID() + ": " + ret);
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);
executedBlocks.add(block.hash);
}