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

Xiang Li commented on HBASE-14882:
----------------------------------

[~anoop.hbase]
bq. Any implication on class loading of the anonymous inner class? Every time 
code path reach, need new defn and load?
Some updates: 
1. (Anonymous) inner class is treated the same as normal class, in terms of 
class loading and initializing. It will be loaded and initialized when the 
first time it is used (or pre-load of class is used). So the anonymous inner 
class will be loaded only once.
2. The instance of inner class has a reference to the instance of outer class. 
It can bee seen by de-compiling .class file, like: (Put$1 is the anonymous 
inner class)
{code}
class Put$1 implements Cell {
    Put$1(Put this$0, byte[] var2, byte[] var3, long var4, byte[] var6) {
          ~~~~~~~~~~
        this.this$0 = this$0;
        ~~~~~~~~~~~~~~~~~~~~
        this.val$family = var2;
        this.val$qualifier = var3;
        this.val$ts = var4;
        this.val$value = var6;
    }
    ...
}
{code}
It will impact GC. The instances of outer class will not be cleaned timely.

I see no other impactions so far.

> Provide a Put API that adds the provided family, qualifier, value without 
> copying
> ---------------------------------------------------------------------------------
>
>                 Key: HBASE-14882
>                 URL: https://issues.apache.org/jira/browse/HBASE-14882
>             Project: HBase
>          Issue Type: Improvement
>    Affects Versions: 1.2.0
>            Reporter: Jerry He
>            Assignee: Xiang Li
>             Fix For: 2.0.0, 1.2.2
>
>         Attachments: HBASE-14882.master.000.patch, 
> HBASE-14882.master.001.patch
>
>
> In the Put API, we have addImmutable()
> {code}
>  /**
>    * See {@link #addColumn(byte[], byte[], byte[])}. This version expects
>    * that the underlying arrays won't change. It's intended
>    * for usage internal HBase to and for advanced client applications.
>    */
>   public Put addImmutable(byte [] family, byte [] qualifier, byte [] value)
> {code}
> But in the implementation, the family, qualifier and value are still being 
> copied locally to create kv.
> Hopefully we should provide an API that truly uses immutable family, 
> qualifier and value.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to