advancedxy commented on code in PR #510:
URL: https://github.com/apache/incubator-uniffle/pull/510#discussion_r1089911947
##########
server/src/main/java/org/apache/uniffle/server/ShuffleFlushManager.java:
##########
@@ -81,40 +82,10 @@ public ShuffleFlushManager(ShuffleServerConf
shuffleServerConf, String shuffleSe
this.maxConcurrencyOfSingleOnePartition =
shuffleServerConf.get(ShuffleServerConf.SERVER_MAX_CONCURRENCY_OF_ONE_PARTITION);
- int waitQueueSize = shuffleServerConf.getInteger(
- ShuffleServerConf.SERVER_FLUSH_THREAD_POOL_QUEUE_SIZE);
- BlockingQueue<Runnable> waitQueue =
Queues.newLinkedBlockingQueue(waitQueueSize);
- int poolSize =
shuffleServerConf.getInteger(ShuffleServerConf.SERVER_FLUSH_THREAD_POOL_SIZE);
- long keepAliveTime =
shuffleServerConf.getLong(ShuffleServerConf.SERVER_FLUSH_THREAD_ALIVE);
- threadPoolExecutor = new ThreadPoolExecutor(poolSize, poolSize,
keepAliveTime, TimeUnit.SECONDS, waitQueue,
- ThreadUtils.getThreadFactory("FlushEventThreadPool"));
+ threadPoolExecutor = createFlushEventExecutor();
storageBasePaths =
shuffleServerConf.get(ShuffleServerConf.RSS_STORAGE_BASE_PATH);
pendingEventTimeoutSec =
shuffleServerConf.getLong(ShuffleServerConf.PENDING_EVENT_TIMEOUT_SEC);
- // the thread for flush data
- Runnable processEventRunnable = () -> {
- while (true) {
- try {
- ShuffleDataFlushEvent event = flushQueue.take();
- threadPoolExecutor.execute(() -> {
- try {
- ShuffleServerMetrics.gaugeWriteHandler.inc();
- flushToFile(event);
- } catch (Exception e) {
- LOG.error("Exception happened when flush data for " + event, e);
- } finally {
- ShuffleServerMetrics.gaugeWriteHandler.dec();
- ShuffleServerMetrics.gaugeEventQueueSize.dec();
- }
- });
- } catch (Exception e) {
- LOG.error("Exception happened when process event.", e);
- }
- }
- };
- Thread processEventThread = new Thread(processEventRunnable);
- processEventThread.setName("ProcessEventThread");
- processEventThread.setDaemon(true);
- processEventThread.start();
+ startEventProcessor();
Review Comment:
nit: let's move L85 before this line since these two lines are related.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]