From 90045fd487e4e81b2a6312cbd811b2a3404435e9 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Fri, 14 Nov 2008 22:01:23 +0000 Subject: [PATCH] Reverted my patch and applied Doug Lea's patch --- .../jboss/netty/util/LinkedTransferQueue.java | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/jboss/netty/util/LinkedTransferQueue.java b/src/main/java/org/jboss/netty/util/LinkedTransferQueue.java index 90814cb596..46c9e83ce0 100644 --- a/src/main/java/org/jboss/netty/util/LinkedTransferQueue.java +++ b/src/main/java/org/jboss/netty/util/LinkedTransferQueue.java @@ -301,12 +301,9 @@ public class LinkedTransferQueue extends AbstractQueue implements Blocking advanceHead(pred, s); // unlink if head if (x == s) { return clean(pred, s); - } else if (x != null) { - s.set(s); // avoid garbage retention - return x; - } else { - return e; } + s.set(s); // mark as off-list + return x != null? x : e; } if (mode == TIMEOUT) { @@ -356,7 +353,6 @@ public class LinkedTransferQueue extends AbstractQueue implements Blocking } } - QNode olddp = UNDEFINED; for (;;) { if (pred.next != s) { return null; @@ -386,7 +382,6 @@ public class LinkedTransferQueue extends AbstractQueue implements Blocking } } - boolean stateUnchanged = true; QNode dp = cleanMe.get(); if (dp != null) { // Try unlinking previous cancelled node QNode d = dp.next; @@ -399,17 +394,10 @@ public class LinkedTransferQueue extends AbstractQueue implements Blocking dn != d && // that is on list dp.casNext(d, dn)) { cleanMe.compareAndSet(dp, null); - stateUnchanged = false; } if (dp == pred) { return null; // s is already saved node } - - if (stateUnchanged && olddp == dp) { - return null; // infinite loop expected - bail out - } else { - olddp = dp; - } } else if (cleanMe.compareAndSet(null, pred)) { return null; // Postpone cleaning s