You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by bh...@apache.org on 2014/01/14 16:11:01 UTC

[1/3] git commit: ACCUMULO-2039 Make Authorizations.getAuthorizationsBB efficient

Updated Branches:
  refs/heads/1.6.0-SNAPSHOT e99275f92 -> 9a34281d3
  refs/heads/master 0c8bb6c01 -> c11e41cbf


ACCUMULO-2039 Make Authorizations.getAuthorizationsBB efficient

Signed-off-by: Bill Havanki <bh...@cloudera.com>


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

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 9a34281d394199eb0dc156d196946b76be47ac43
Parents: e99275f
Author: Vikram Srivastava <vi...@cloudera.com>
Authored: Sat Jan 11 20:59:54 2014 -0800
Committer: Bill Havanki <bh...@cloudera.com>
Committed: Tue Jan 14 10:04:57 2014 -0500

----------------------------------------------------------------------
 .../apache/accumulo/core/security/Authorizations.java |  8 +++++++-
 .../org/apache/accumulo/core/util/ByteBufferUtil.java | 14 --------------
 2 files changed, 7 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/9a34281d/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java b/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java
index 8350e2e..ab3ea68 100644
--- a/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java
+++ b/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java
@@ -227,7 +227,13 @@ public class Authorizations implements Iterable<byte[]>, Serializable, Authoriza
    * @return authorizations, each as a string encoded in UTF-8 and within a buffer
    */
   public List<ByteBuffer> getAuthorizationsBB() {
-    return ByteBufferUtil.toImmutableByteBufferList(getAuthorizations());
+    ArrayList<ByteBuffer> copy = new ArrayList<ByteBuffer>(authsList.size());
+    for (byte[] auth : authsList) {
+      byte[] bytes = new byte[auth.length];
+      System.arraycopy(auth, 0, bytes, 0, auth.length);
+      copy.add(ByteBuffer.wrap(bytes));
+    }
+    return Collections.unmodifiableList(copy);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9a34281d/core/src/main/java/org/apache/accumulo/core/util/ByteBufferUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/ByteBufferUtil.java b/core/src/main/java/org/apache/accumulo/core/util/ByteBufferUtil.java
index 6f6a9ee..b95aeda 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/ByteBufferUtil.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/ByteBufferUtil.java
@@ -20,7 +20,6 @@ import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 
 import org.apache.accumulo.core.data.ByteSequence;
@@ -43,19 +42,6 @@ public class ByteBufferUtil {
     return result;
   }
   
-  /**
-   * Provides an immutable view of a list of byte buffers, representing the same bytes. This does not protect against modifying the underlying byte arrays.
-   */
-  public static List<ByteBuffer> toImmutableByteBufferList(Collection<byte[]> bytesList) {
-    if (bytesList == null)
-      return null;
-    ArrayList<ByteBuffer> result = new ArrayList<ByteBuffer>();
-    for (byte[] bytes : bytesList) {
-      result.add(ByteBuffer.wrap(bytes));
-    }
-    return Collections.unmodifiableList(result);
-  }
-  
   public static List<byte[]> toBytesList(Collection<ByteBuffer> bytesList) {
     if (bytesList == null)
       return null;


[2/3] git commit: ACCUMULO-2039 Make Authorizations.getAuthorizationsBB efficient

Posted by bh...@apache.org.
ACCUMULO-2039 Make Authorizations.getAuthorizationsBB efficient

Signed-off-by: Bill Havanki <bh...@cloudera.com>


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

Branch: refs/heads/master
Commit: 9a34281d394199eb0dc156d196946b76be47ac43
Parents: e99275f
Author: Vikram Srivastava <vi...@cloudera.com>
Authored: Sat Jan 11 20:59:54 2014 -0800
Committer: Bill Havanki <bh...@cloudera.com>
Committed: Tue Jan 14 10:04:57 2014 -0500

----------------------------------------------------------------------
 .../apache/accumulo/core/security/Authorizations.java |  8 +++++++-
 .../org/apache/accumulo/core/util/ByteBufferUtil.java | 14 --------------
 2 files changed, 7 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/9a34281d/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java b/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java
index 8350e2e..ab3ea68 100644
--- a/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java
+++ b/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java
@@ -227,7 +227,13 @@ public class Authorizations implements Iterable<byte[]>, Serializable, Authoriza
    * @return authorizations, each as a string encoded in UTF-8 and within a buffer
    */
   public List<ByteBuffer> getAuthorizationsBB() {
-    return ByteBufferUtil.toImmutableByteBufferList(getAuthorizations());
+    ArrayList<ByteBuffer> copy = new ArrayList<ByteBuffer>(authsList.size());
+    for (byte[] auth : authsList) {
+      byte[] bytes = new byte[auth.length];
+      System.arraycopy(auth, 0, bytes, 0, auth.length);
+      copy.add(ByteBuffer.wrap(bytes));
+    }
+    return Collections.unmodifiableList(copy);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9a34281d/core/src/main/java/org/apache/accumulo/core/util/ByteBufferUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/ByteBufferUtil.java b/core/src/main/java/org/apache/accumulo/core/util/ByteBufferUtil.java
index 6f6a9ee..b95aeda 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/ByteBufferUtil.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/ByteBufferUtil.java
@@ -20,7 +20,6 @@ import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 
 import org.apache.accumulo.core.data.ByteSequence;
@@ -43,19 +42,6 @@ public class ByteBufferUtil {
     return result;
   }
   
-  /**
-   * Provides an immutable view of a list of byte buffers, representing the same bytes. This does not protect against modifying the underlying byte arrays.
-   */
-  public static List<ByteBuffer> toImmutableByteBufferList(Collection<byte[]> bytesList) {
-    if (bytesList == null)
-      return null;
-    ArrayList<ByteBuffer> result = new ArrayList<ByteBuffer>();
-    for (byte[] bytes : bytesList) {
-      result.add(ByteBuffer.wrap(bytes));
-    }
-    return Collections.unmodifiableList(result);
-  }
-  
   public static List<byte[]> toBytesList(Collection<ByteBuffer> bytesList) {
     if (bytesList == null)
       return null;


[3/3] git commit: ACCUMULO-2039 Merge branch '1.6.0-SNAPSHOT'

Posted by bh...@apache.org.
ACCUMULO-2039 Merge branch '1.6.0-SNAPSHOT'


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

Branch: refs/heads/master
Commit: c11e41cbf5d732c574c1aab96d1df56458c4240d
Parents: 0c8bb6c 9a34281
Author: Bill Havanki <bh...@cloudera.com>
Authored: Tue Jan 14 10:09:59 2014 -0500
Committer: Bill Havanki <bh...@cloudera.com>
Committed: Tue Jan 14 10:09:59 2014 -0500

----------------------------------------------------------------------
 .../apache/accumulo/core/security/Authorizations.java |  8 +++++++-
 .../org/apache/accumulo/core/util/ByteBufferUtil.java | 14 --------------
 2 files changed, 7 insertions(+), 15 deletions(-)
----------------------------------------------------------------------