Bugfix/timeout queue full (#3451)
authorxujingfeng <250577914@qq.com>
Tue, 12 Feb 2019 04:23:30 +0000 (12:23 +0800)
committer时无两丶 <442367943@qq.com>
Tue, 12 Feb 2019 04:23:30 +0000 (12:23 +0800)
replace ArrayBlockingQueue with LinkedBlockingQueue and remove capacity.

dubbo-common/src/main/java/org/apache/dubbo/common/timer/HashedWheelTimer.java

index f786cae..6ee4a91 100644 (file)
@@ -25,9 +25,9 @@ import java.util.HashSet;
 import java.util.Locale;
 import java.util.Queue;
 import java.util.Set;
-import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executors;
+import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
@@ -109,8 +109,8 @@ public class HashedWheelTimer implements Timer {
     private final HashedWheelBucket[] wheel;
     private final int mask;
     private final CountDownLatch startTimeInitialized = new CountDownLatch(1);
-    private final Queue<HashedWheelTimeout> timeouts = new ArrayBlockingQueue<HashedWheelTimeout>(1024);
-    private final Queue<HashedWheelTimeout> cancelledTimeouts = new ArrayBlockingQueue<HashedWheelTimeout>(1024);
+    private final Queue<HashedWheelTimeout> timeouts = new LinkedBlockingQueue<>();
+    private final Queue<HashedWheelTimeout> cancelledTimeouts = new LinkedBlockingQueue<>();
     private final AtomicLong pendingTimeouts = new AtomicLong(0);
     private final long maxPendingTimeouts;