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()));