From 0950c1ad6e5cebc6fe0ec2d45216060b81e72912 Mon Sep 17 00:00:00 2001 From: lijial Date: Tue, 22 Dec 2020 16:05:04 +0800 Subject: [PATCH] ArrayBlockingQueueBuffer del IF_POSSIBLE strategy (#6053) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ArrayBlockingQueueBuffer del IF_POSSIBLE strategy * update CHANGES.md Co-authored-by: 李家良 --- CHANGES.md | 1 + .../buffer/ArrayBlockingQueueBuffer.java | 16 ++++++---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 43731e994..d69dc51a0 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 186709972..1b9010494 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 implements QueueBuffer { @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; }