You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2020/12/22 08:05:23 UTC

[skywalking] branch master updated: ArrayBlockingQueueBuffer del IF_POSSIBLE strategy (#6053)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new 0950c1a  ArrayBlockingQueueBuffer del IF_POSSIBLE strategy (#6053)
0950c1a is described below

commit 0950c1ad6e5cebc6fe0ec2d45216060b81e72912
Author: lijial <li...@users.noreply.github.com>
AuthorDate: Tue Dec 22 16:05:04 2020 +0800

    ArrayBlockingQueueBuffer del IF_POSSIBLE strategy (#6053)
    
    * ArrayBlockingQueueBuffer del IF_POSSIBLE strategy
    
    * update CHANGES.md
    
    Co-authored-by: 李家良 <ji...@tongdun.cn>
---
 CHANGES.md                                               |  1 +
 .../datacarrier/buffer/ArrayBlockingQueueBuffer.java     | 16 ++++++----------
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 43731e9..d69dc51 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -20,6 +20,7 @@ Release Notes.
 * Fix thrift plugin trace link broken when intermediate service does not mount agent
 * Fix thrift plugin collects wrong args when the method without parameter.
 * Fix DataCarrier's `org.apache.skywalking.apm.commons.datacarrier.buffer.Buffer` implementation isn't activated in `IF_POSSIBLE` mode.
+* Fix ArrayBlockingQueueBuffer's useless `IF_POSSIBLE` mode list
 
 #### OAP-Backend
 * Make meter receiver support MAL.
diff --git a/apm-commons/apm-datacarrier/src/main/java/org/apache/skywalking/apm/commons/datacarrier/buffer/ArrayBlockingQueueBuffer.java b/apm-commons/apm-datacarrier/src/main/java/org/apache/skywalking/apm/commons/datacarrier/buffer/ArrayBlockingQueueBuffer.java
index 1867099..1b90104 100644
--- a/apm-commons/apm-datacarrier/src/main/java/org/apache/skywalking/apm/commons/datacarrier/buffer/ArrayBlockingQueueBuffer.java
+++ b/apm-commons/apm-datacarrier/src/main/java/org/apache/skywalking/apm/commons/datacarrier/buffer/ArrayBlockingQueueBuffer.java
@@ -40,16 +40,12 @@ public class ArrayBlockingQueueBuffer<T> implements QueueBuffer<T> {
 
     @Override
     public boolean save(T data) {
-        switch (strategy) {
-            case IF_POSSIBLE:
-                return queue.offer(data);
-            default:
-                try {
-                    queue.put(data);
-                } catch (InterruptedException e) {
-                    // Ignore the error
-                    return false;
-                }
+        //only BufferStrategy.BLOCKING
+        try {
+            queue.put(data);
+        } catch (InterruptedException e) {
+            // Ignore the error
+            return false;
         }
         return true;
     }