a1vin-tian commented on pull request #7153:
URL: https://github.com/apache/skywalking/pull/7153#issuecomment-866775224


   If use LinkedBlockingQueue:
   ``` java
   class BlockingBatchQueue{
   
   private final LinkedBlockingQueue<E> elementData = new 
LinkedBlockingQueue<>();
   
           public void putMany(List<E> elements) {
               elementData.addAll(elements);
           }
   
           public List<E> popMany() throws InterruptedException {
               List<E> subList = new ArrayList<>();
               do {
                   E poll = elementData.poll(1000, TimeUnit.MILLISECONDS);
                   if (poll != null) {
                       subList.add(poll);
                   }
                   if (subList.size() >= maxBatchSize || !needFillFully) {
                       return subList;
                   }
               }
               while (true);
           }
   }
   ```
   
   


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to