From 87d32ab2201b9df249b3e6ebd5b866dea9edfe73 Mon Sep 17 00:00:00 2001 From: "Frank.R.Wu" Date: Thu, 10 Feb 2022 11:13:28 +0800 Subject: [PATCH] feat: update SelfAdaptiveSharding use independent thread pool to handle messages;ignore body validation --- .../trustedmodel/SelfAdaptiveShardingExecutor.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/bdware/server/trustedmodel/SelfAdaptiveShardingExecutor.java b/src/main/java/org/bdware/server/trustedmodel/SelfAdaptiveShardingExecutor.java index d97dac5..226ad60 100644 --- a/src/main/java/org/bdware/server/trustedmodel/SelfAdaptiveShardingExecutor.java +++ b/src/main/java/org/bdware/server/trustedmodel/SelfAdaptiveShardingExecutor.java @@ -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()));