Repository: cassandra Updated Branches: refs/heads/trunk d1dd3ce72 -> 89afc956d
use short-circuiting ops Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/89afc956 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/89afc956 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/89afc956 Branch: refs/heads/trunk Commit: 89afc956d8b6281ca29de8df3f7949574c6b34f5 Parents: d1dd3ce Author: Dave Brosius <dbros...@mebigfatguy.com> Authored: Tue Jun 9 21:02:41 2015 -0400 Committer: Dave Brosius <dbros...@mebigfatguy.com> Committed: Tue Jun 9 21:02:41 2015 -0400 ---------------------------------------------------------------------- src/java/org/apache/cassandra/utils/memory/BufferPool.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/89afc956/src/java/org/apache/cassandra/utils/memory/BufferPool.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/utils/memory/BufferPool.java b/src/java/org/apache/cassandra/utils/memory/BufferPool.java index 0731301..a64cfb0 100644 --- a/src/java/org/apache/cassandra/utils/memory/BufferPool.java +++ b/src/java/org/apache/cassandra/utils/memory/BufferPool.java @@ -86,7 +86,7 @@ public class BufferPool public static ByteBuffer get(int size, BufferType bufferType) { boolean direct = bufferType == BufferType.OFF_HEAP; - if (DISABLED | !direct) + if (DISABLED || !direct) return allocate(size, !direct); else return takeFromPool(size, !direct); @@ -141,7 +141,7 @@ public class BufferPool public static void put(ByteBuffer buffer) { - if (!(DISABLED | buffer.hasArray())) + if (!(DISABLED || buffer.hasArray())) localPool.get().put(buffer); } @@ -408,7 +408,7 @@ public class BufferPool if (owner == this) removeFromLocalQueue(chunk); } - else if (((free == -1L) & owner != this) && chunk.owner == null) + else if (((free == -1L) && owner != this) && chunk.owner == null) { // although we try to take recycle ownership cheaply, it is not always possible to do so if the owner is racing to unset. // we must also check after completely freeing if the owner has since been unset, and try to recycle @@ -830,7 +830,7 @@ public class BufferPool long cur = freeSlots; next = cur | shiftedSlotBits; assert next == (cur ^ shiftedSlotBits); // ensure no double free - if (tryRelease & (next == -1L)) + if (tryRelease && (next == -1L)) next = 0L; if (freeSlotsUpdater.compareAndSet(this, cur, next)) return next;