[ 
https://issues.apache.org/jira/browse/HBASE-10529?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13908061#comment-13908061
 ] 

Matt Corgan commented on HBASE-10529:
-------------------------------------

if you want it to replace the KeyValue param with a Cell param, what about 
something like:
{code}
private KeyValue maybeCloneWithAllocator(Cell cell) {
    if (allocator == null) {
      return KeyValueUtil.ensureKeyValue(cell);
    }

    int len = KeyValueUtil.getLength(cell);
    Allocation alloc = allocator.allocateBytes(len);
    if (alloc == null) {
      // The allocation was too large, allocator decided
      // not to do anything with it.
      return KeyValueUtil.ensureKeyValue(cell);
    }
    assert alloc.getData() != null;
    KeyValueUtil.copyToArray(cell, alloc.getData(), alloc.getOffset(), len);
    KeyValue newKv = new KeyValue(alloc.getData(), alloc.getOffset(), len);
    newKv.setMvccVersion(kv.getMvccVersion());
    return newKv;
  }
{code}

> Make Cell extend Cloneable
> --------------------------
>
>                 Key: HBASE-10529
>                 URL: https://issues.apache.org/jira/browse/HBASE-10529
>             Project: HBase
>          Issue Type: Sub-task
>            Reporter: ramkrishna.s.vasudevan
>            Assignee: ramkrishna.s.vasudevan
>             Fix For: 0.99.0
>
>         Attachments: HBSE-10529.patch
>
>
> Refer to the parent JIRA for discussion on making extending Cloneable.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to