rjvkr2021 commented on code in PR #3844:
URL: https://github.com/apache/celeborn/pull/3844#discussion_r3970926966
##########
client/src/main/java/org/apache/celeborn/client/write/DataPusher.java:
##########
@@ -170,20 +191,46 @@ public void addTask(int partitionId, byte[] buffer, int
size)
logger.error("DataPusher thread interrupted while adding push task.");
pushThread.interrupt();
throw e;
+ } finally {
+ lifecycleLock.lock();
+ try {
+ activeProducers--;
+ if (activeProducers == 0) {
+ producersDrained.signalAll();
+ }
+ } finally {
+ lifecycleLock.unlock();
+ }
}
}
public void waitOnTermination() throws IOException, InterruptedException {
+ lifecycleLock.lockInterruptibly();
try {
- idleLock.lockInterruptibly();
- waitIdleQueueFullWithLock();
+ if (lifecycleState == LifecycleState.RUNNING) {
+ lifecycleState = LifecycleState.CLOSING;
+ }
+ while (activeProducers > 0) {
+ producersDrained.await();
+ }
} catch (InterruptedException e) {
logger.error("DataPusher thread interrupted while waitOnTermination.");
pushThread.interrupt();
throw e;
+ } finally {
+ lifecycleLock.unlock();
}
- terminated = true;
+ idleLock.lockInterruptibly();
+ waitIdleQueueFullWithLock();
+
+ lifecycleLock.lock();
+ try {
+ lifecycleState = LifecycleState.TERMINATED;
+ terminated = true;
+ } finally {
+ lifecycleLock.unlock();
+ }
Review Comment:
`waitIdleQueueFullWithLock()` does release `idleLock`
--
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]