cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1028507 - /cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/dht/BytesToken.java
Date Thu, 28 Oct 2010 21:40:20 GMT
Author: jbellis
Date: Thu Oct 28 21:40:19 2010
New Revision: 1028507

URL: http://svn.apache.org/viewvc?rev=1028507&view=rev
Log:
avoid duplicate when ByteBuffer is entire array.  patch by jbellis

Modified:
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/dht/BytesToken.java

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/dht/BytesToken.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/dht/BytesToken.java?rev=1028507&r1=1028506&r2=1028507&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/dht/BytesToken.java (original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/dht/BytesToken.java Thu
Oct 28 21:40:19 2010
@@ -37,18 +37,13 @@ public class BytesToken extends Token<by
     
     private static byte[] convertByteBuffer(ByteBuffer token)
     {
-        token = token.duplicate();
         if (token.position() == 0 && token.arrayOffset() == 0 && token.limit()
== token.capacity())
-        {
             return token.array();
-        }
-        else
-        {
-            byte[] buf = new byte[token.remaining()];
-            token.get(buf);
 
-            return buf;
-        }
+        token = token.duplicate();
+        byte[] buf = new byte[token.remaining()];
+        token.get(buf);
+        return buf;
     }
     
     @Override



Mime
View raw message