zhangshenghang commented on code in PR #7693:
URL: https://github.com/apache/seatunnel/pull/7693#discussion_r1801245751


##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/utils/PeekBlockingQueue.java:
##########


Review Comment:
   PeekBlockingQueue Desc:
   
   PeekBlockingQueue implements blocking when peeking. Queues like 
BlockingQueue only support blocking when taking(). The original solution was to 
use sleep(2000) to determine whether there is data in the pending queue. This 
solution still has performance loss, so it is changed to peek blocking, which 
can schedule tasks faster.
   Application scenario:
   In CoordinatorService, we need to execute the following process 1. peek 
data, 2. determine whether resources are sufficient 3. If resources are 
sufficient, take() to get data, otherwise do not take data from the queue.
   
   
![无标题-2024-09-08-0753](https://github.com/user-attachments/assets/a87eab07-ea9a-4456-aa37-87f57e70eb30)
   



-- 
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]

Reply via email to