feat: update SelfAdaptiveSharding

use independent thread pool to handle messages;ignore body validation
This commit is contained in:
Frank.R.Wu 2022-02-10 11:13:28 +08:00
parent ed507b14b4
commit 87d32ab220

View File

@ -20,10 +20,7 @@ import org.bdware.server.action.CMActions;
import org.bdware.units.NetworkManager;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
import java.util.stream.Collectors;
/**
@ -48,12 +45,12 @@ public class SelfAdaptiveShardingExecutor implements ContractExecutor {
public SelfAdaptiveShardingExecutor(String contractID) {
this.meta = CMActions.manager.multiContractRecorder.getMultiContractMeta(contractID);
this.future = ContractManager.scheduledThreadPool.scheduleWithFixedDelay(
this.future = Executors.newScheduledThreadPool(1).scheduleWithFixedDelay(
this::submitBlock,
DELAY,
DELAY,
TimeUnit.SECONDS);
ContractManager.threadPool.execute(() -> {
Executors.newCachedThreadPool().execute(() -> {
LOGGER.info(String.format(
"[Executor %s] starting executing service... %b",
meta.getContractID(), meta.isMaster()));