accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ujustgotbi...@apache.org
Subject [4/6] accumulo git commit: Merge branch '1.5' into 1.6
Date Sun, 12 Apr 2015 19:46:33 GMT
Merge branch '1.5' into 1.6


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/2364c26f
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/2364c26f
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/2364c26f

Branch: refs/heads/master
Commit: 2364c26f4a6657c3149da1e1f82d2798dc2a0fa5
Parents: 6fa2090 9132611
Author: Bill Slacum <ujustgotbilld@apache.org>
Authored: Sun Apr 12 14:20:59 2015 -0400
Committer: Bill Slacum <ujustgotbilld@apache.org>
Committed: Sun Apr 12 14:20:59 2015 -0400

----------------------------------------------------------------------
 .../org/apache/accumulo/core/data/Mutation.java | 29 ++++++++++++--------
 1 file changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/2364c26f/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/data/Mutation.java
index 233a12e,27b590e..5b052c3
--- a/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
+++ b/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
@@@ -19,6 -19,6 +19,7 @@@ package org.apache.accumulo.core.data
  import java.io.DataInput;
  import java.io.DataOutput;
  import java.io.IOException;
++import java.nio.ByteBuffer;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Collections;
@@@ -85,11 -197,11 +86,11 @@@ public class Mutation implements Writab
     * called previously. Otherwise, this.data will be returned since the buffer is
     * null and will not change.
     */
-   private byte[] serializedSnapshot() {
 -  private java.nio.ByteBuffer serializedSnapshot() {
++  private ByteBuffer serializedSnapshot() {
      if (buffer != null) {
-       return buffer.toArray();
 -      return java.nio.ByteBuffer.wrap(this.buffer.data, 0, this.buffer.offset);
++      return this.buffer.toByteBuffer();
      } else {
-       return this.data;
 -      return java.nio.ByteBuffer.wrap(this.data);
++      return ByteBuffer.wrap(this.data);
      }
    }
  
@@@ -600,22 -708,10 +601,22 @@@
      return toThrift(false).hashCode();
    }
  
 +  /**
 +   * Checks if this mutation equals another. This method may be removed in a future API
revision in favor of {@link #equals(Object)}. See ACCUMULO-1627 for more
 +   * information.
 +   *
 +   * @param m
 +   *          mutation
 +   * @return true if the given mutation equals this one, false otehrwise
 +   */
    public boolean equals(Mutation m) {
 -    java.nio.ByteBuffer myData = serializedSnapshot();
 -    java.nio.ByteBuffer otherData = m.serializedSnapshot();
 +    return this.equals((Object) m);
 +  }
 +
 +  private boolean equalMutation(Mutation m) {
-     byte[] myData = serializedSnapshot();
-     byte[] otherData = m.serializedSnapshot();
-     if (Arrays.equals(row, m.row) && entries == m.entries && Arrays.equals(myData,
otherData)) {
++    ByteBuffer myData = serializedSnapshot();
++    ByteBuffer otherData = m.serializedSnapshot();
+     if (Arrays.equals(row, m.row) && entries == m.entries && myData.equals(otherData))
{
        if (values == null && m.values == null)
          return true;
  
@@@ -638,14 -743,11 +648,11 @@@
    }
  
    private TMutation toThrift(boolean serialize) {
-     byte[] data;
      if (serialize) {
        this.serialize();
-       data = this.data;
-     } else {
-       data = serializedSnapshot();
      }
-     return new TMutation(java.nio.ByteBuffer.wrap(row), java.nio.ByteBuffer.wrap(data),
ByteBufferUtil.toByteBuffers(values), entries);
 -    java.nio.ByteBuffer data = serializedSnapshot();
 -    return new TMutation(java.nio.ByteBuffer.wrap(row), data, ByteBufferUtil.toByteBuffers(values),
entries);
++    ByteBuffer data = serializedSnapshot();
++    return new TMutation(ByteBuffer.wrap(row), data, ByteBufferUtil.toByteBuffers(values),
entries);
    }
  
    protected SERIALIZED_FORMAT getSerializedFormat() {


Mime
View raw message