4040import org .apache .iotdb .db .consensus .DataRegionConsensusImpl ;
4141import org .apache .iotdb .db .consensus .SchemaRegionConsensusImpl ;
4242import org .apache .iotdb .db .protocol .thrift .impl .DataNodeRegionManager ;
43- import org .apache .iotdb .db .storageengine .rescon .memory .AbstractPoolManager ;
4443import org .apache .iotdb .mpp .rpc .thrift .TMaintainPeerReq ;
4544import org .apache .iotdb .mpp .rpc .thrift .TRegionMigrateResult ;
4645import org .apache .iotdb .mpp .rpc .thrift .TResetPeerListReq ;
5352import java .util .List ;
5453import java .util .Map ;
5554import java .util .concurrent .ConcurrentHashMap ;
55+ import java .util .concurrent .ExecutorService ;
5656import java .util .stream .Collectors ;
5757
5858public class RegionMigrateService implements IService {
@@ -65,7 +65,7 @@ public class RegionMigrateService implements IService {
6565
6666 private static final int SLEEP_MILLIS = 5000 ;
6767
68- private RegionMigratePool regionMigratePool ;
68+ private ExecutorService regionMigratePool ;
6969
7070 // Map<taskId, taskStatus>
7171 // TODO: Due to the use of procedureId as taskId, it is currently unable to handle the situation
@@ -199,15 +199,15 @@ private boolean addToTaskResultMap(long taskId) {
199199
200200 @ Override
201201 public void start () throws StartupException {
202- regionMigratePool = new RegionMigratePool ();
203- regionMigratePool . start ( );
202+ regionMigratePool =
203+ IoTDBThreadPoolFactory . newCachedThreadPool ( ThreadName . REGION_MIGRATE . getName () );
204204 LOGGER .info ("Region migrate service start" );
205205 }
206206
207207 @ Override
208208 public void stop () {
209209 if (regionMigratePool != null ) {
210- regionMigratePool .stop ();
210+ regionMigratePool .shutdown ();
211211 }
212212 LOGGER .info ("Region migrate service stop" );
213213 }
@@ -217,32 +217,6 @@ public ServiceType getID() {
217217 return ServiceType .DATA_NODE_REGION_MIGRATE_SERVICE ;
218218 }
219219
220- private static class RegionMigratePool extends AbstractPoolManager {
221-
222- private final Logger poolLogger = LoggerFactory .getLogger (RegionMigratePool .class );
223-
224- private RegionMigratePool () {
225- this .pool = IoTDBThreadPoolFactory .newCachedThreadPool (ThreadName .REGION_MIGRATE .getName ());
226- }
227-
228- @ Override
229- public Logger getLogger () {
230- return poolLogger ;
231- }
232-
233- @ Override
234- public void start () {
235- if (this .pool != null ) {
236- poolLogger .info ("DataNode region migrate pool start" );
237- }
238- }
239-
240- @ Override
241- public String getName () {
242- return "migrate region" ;
243- }
244- }
245-
246220 private static class AddRegionPeerTask implements Runnable {
247221
248222 private static final Logger taskLogger = LoggerFactory .getLogger (AddRegionPeerTask .class );
0 commit comments