hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject [38/51] [partial] hbase-site git commit: Published site at 18eff3c1c337003b2a419490e621f931d16936fb.
Date Fri, 05 Feb 2016 04:32:48 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/a8725a46/devapidocs/src-html/org/apache/hadoop/hbase/ipc/AsyncRpcChannel.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/ipc/AsyncRpcChannel.html b/devapidocs/src-html/org/apache/hadoop/hbase/ipc/AsyncRpcChannel.html
index 86ba709..f4bddcd 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/ipc/AsyncRpcChannel.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/ipc/AsyncRpcChannel.html
@@ -420,7 +420,7 @@
 <span class="sourceLineNo">412</span>        requestHeaderBuilder.setCellBlockMeta(cellBlockBuilder.build());<a name="line.412"></a>
 <span class="sourceLineNo">413</span>      }<a name="line.413"></a>
 <span class="sourceLineNo">414</span>      // Only pass priority if there one.  Let zero be same as no priority.<a name="line.414"></a>
-<span class="sourceLineNo">415</span>      if (call.controller.getPriority() != 0) {<a name="line.415"></a>
+<span class="sourceLineNo">415</span>      if (call.controller.getPriority() != PayloadCarryingRpcController.PRIORITY_UNSET) {<a name="line.415"></a>
 <span class="sourceLineNo">416</span>        requestHeaderBuilder.setPriority(call.controller.getPriority());<a name="line.416"></a>
 <span class="sourceLineNo">417</span>      }<a name="line.417"></a>
 <span class="sourceLineNo">418</span><a name="line.418"></a>
@@ -668,96 +668,97 @@
 <span class="sourceLineNo">660</span>  private void handleSaslConnectionFailure(final int currRetries, final Throwable ex,<a name="line.660"></a>
 <span class="sourceLineNo">661</span>      final UserGroupInformation user) throws IOException, InterruptedException {<a name="line.661"></a>
 <span class="sourceLineNo">662</span>    user.doAs(new PrivilegedExceptionAction&lt;Void&gt;() {<a name="line.662"></a>
-<span class="sourceLineNo">663</span>      public Void run() throws IOException, InterruptedException {<a name="line.663"></a>
-<span class="sourceLineNo">664</span>        if (shouldAuthenticateOverKrb()) {<a name="line.664"></a>
-<span class="sourceLineNo">665</span>          if (currRetries &lt; MAX_SASL_RETRIES) {<a name="line.665"></a>
-<span class="sourceLineNo">666</span>            LOG.debug("Exception encountered while connecting to the server : " + ex);<a name="line.666"></a>
-<span class="sourceLineNo">667</span>            //try re-login<a name="line.667"></a>
-<span class="sourceLineNo">668</span>            if (UserGroupInformation.isLoginKeytabBased()) {<a name="line.668"></a>
-<span class="sourceLineNo">669</span>              UserGroupInformation.getLoginUser().reloginFromKeytab();<a name="line.669"></a>
-<span class="sourceLineNo">670</span>            } else {<a name="line.670"></a>
-<span class="sourceLineNo">671</span>              UserGroupInformation.getLoginUser().reloginFromTicketCache();<a name="line.671"></a>
-<span class="sourceLineNo">672</span>            }<a name="line.672"></a>
-<span class="sourceLineNo">673</span><a name="line.673"></a>
-<span class="sourceLineNo">674</span>            // Should reconnect<a name="line.674"></a>
-<span class="sourceLineNo">675</span>            return null;<a name="line.675"></a>
-<span class="sourceLineNo">676</span>          } else {<a name="line.676"></a>
-<span class="sourceLineNo">677</span>            String msg = "Couldn't setup connection for " +<a name="line.677"></a>
-<span class="sourceLineNo">678</span>                UserGroupInformation.getLoginUser().getUserName() +<a name="line.678"></a>
-<span class="sourceLineNo">679</span>                " to " + serverPrincipal;<a name="line.679"></a>
-<span class="sourceLineNo">680</span>            LOG.warn(msg);<a name="line.680"></a>
-<span class="sourceLineNo">681</span>            throw (IOException) new IOException(msg).initCause(ex);<a name="line.681"></a>
-<span class="sourceLineNo">682</span>          }<a name="line.682"></a>
-<span class="sourceLineNo">683</span>        } else {<a name="line.683"></a>
-<span class="sourceLineNo">684</span>          LOG.warn("Exception encountered while connecting to " +<a name="line.684"></a>
-<span class="sourceLineNo">685</span>              "the server : " + ex);<a name="line.685"></a>
-<span class="sourceLineNo">686</span>        }<a name="line.686"></a>
-<span class="sourceLineNo">687</span>        if (ex instanceof RemoteException) {<a name="line.687"></a>
-<span class="sourceLineNo">688</span>          throw (RemoteException) ex;<a name="line.688"></a>
-<span class="sourceLineNo">689</span>        }<a name="line.689"></a>
-<span class="sourceLineNo">690</span>        if (ex instanceof SaslException) {<a name="line.690"></a>
-<span class="sourceLineNo">691</span>          String msg = "SASL authentication failed." +<a name="line.691"></a>
-<span class="sourceLineNo">692</span>              " The most likely cause is missing or invalid credentials." +<a name="line.692"></a>
-<span class="sourceLineNo">693</span>              " Consider 'kinit'.";<a name="line.693"></a>
-<span class="sourceLineNo">694</span>          LOG.fatal(msg, ex);<a name="line.694"></a>
-<span class="sourceLineNo">695</span>          throw new RuntimeException(msg, ex);<a name="line.695"></a>
-<span class="sourceLineNo">696</span>        }<a name="line.696"></a>
-<span class="sourceLineNo">697</span>        throw new IOException(ex);<a name="line.697"></a>
-<span class="sourceLineNo">698</span>      }<a name="line.698"></a>
-<span class="sourceLineNo">699</span>    });<a name="line.699"></a>
-<span class="sourceLineNo">700</span>  }<a name="line.700"></a>
-<span class="sourceLineNo">701</span><a name="line.701"></a>
-<span class="sourceLineNo">702</span>  public int getConnectionHashCode() {<a name="line.702"></a>
-<span class="sourceLineNo">703</span>    return ConnectionId.hashCode(ticket, serviceName, address);<a name="line.703"></a>
-<span class="sourceLineNo">704</span>  }<a name="line.704"></a>
-<span class="sourceLineNo">705</span>  <a name="line.705"></a>
-<span class="sourceLineNo">706</span>  @Override<a name="line.706"></a>
-<span class="sourceLineNo">707</span>  public int hashCode() {<a name="line.707"></a>
-<span class="sourceLineNo">708</span>    return getConnectionHashCode();<a name="line.708"></a>
-<span class="sourceLineNo">709</span>  }<a name="line.709"></a>
-<span class="sourceLineNo">710</span>     <a name="line.710"></a>
-<span class="sourceLineNo">711</span>  @Override<a name="line.711"></a>
-<span class="sourceLineNo">712</span>  public boolean equals(Object obj) {<a name="line.712"></a>
-<span class="sourceLineNo">713</span>    if (obj instanceof AsyncRpcChannel) {<a name="line.713"></a>
-<span class="sourceLineNo">714</span>      AsyncRpcChannel channel = (AsyncRpcChannel) obj;<a name="line.714"></a>
-<span class="sourceLineNo">715</span>      return channel.hashCode() == obj.hashCode();<a name="line.715"></a>
-<span class="sourceLineNo">716</span>    }<a name="line.716"></a>
-<span class="sourceLineNo">717</span>    return false;<a name="line.717"></a>
-<span class="sourceLineNo">718</span>  }<a name="line.718"></a>
-<span class="sourceLineNo">719</span><a name="line.719"></a>
+<span class="sourceLineNo">663</span>      @Override<a name="line.663"></a>
+<span class="sourceLineNo">664</span>      public Void run() throws IOException, InterruptedException {<a name="line.664"></a>
+<span class="sourceLineNo">665</span>        if (shouldAuthenticateOverKrb()) {<a name="line.665"></a>
+<span class="sourceLineNo">666</span>          if (currRetries &lt; MAX_SASL_RETRIES) {<a name="line.666"></a>
+<span class="sourceLineNo">667</span>            LOG.debug("Exception encountered while connecting to the server : " + ex);<a name="line.667"></a>
+<span class="sourceLineNo">668</span>            //try re-login<a name="line.668"></a>
+<span class="sourceLineNo">669</span>            if (UserGroupInformation.isLoginKeytabBased()) {<a name="line.669"></a>
+<span class="sourceLineNo">670</span>              UserGroupInformation.getLoginUser().reloginFromKeytab();<a name="line.670"></a>
+<span class="sourceLineNo">671</span>            } else {<a name="line.671"></a>
+<span class="sourceLineNo">672</span>              UserGroupInformation.getLoginUser().reloginFromTicketCache();<a name="line.672"></a>
+<span class="sourceLineNo">673</span>            }<a name="line.673"></a>
+<span class="sourceLineNo">674</span><a name="line.674"></a>
+<span class="sourceLineNo">675</span>            // Should reconnect<a name="line.675"></a>
+<span class="sourceLineNo">676</span>            return null;<a name="line.676"></a>
+<span class="sourceLineNo">677</span>          } else {<a name="line.677"></a>
+<span class="sourceLineNo">678</span>            String msg = "Couldn't setup connection for " +<a name="line.678"></a>
+<span class="sourceLineNo">679</span>                UserGroupInformation.getLoginUser().getUserName() +<a name="line.679"></a>
+<span class="sourceLineNo">680</span>                " to " + serverPrincipal;<a name="line.680"></a>
+<span class="sourceLineNo">681</span>            LOG.warn(msg);<a name="line.681"></a>
+<span class="sourceLineNo">682</span>            throw (IOException) new IOException(msg).initCause(ex);<a name="line.682"></a>
+<span class="sourceLineNo">683</span>          }<a name="line.683"></a>
+<span class="sourceLineNo">684</span>        } else {<a name="line.684"></a>
+<span class="sourceLineNo">685</span>          LOG.warn("Exception encountered while connecting to " +<a name="line.685"></a>
+<span class="sourceLineNo">686</span>              "the server : " + ex);<a name="line.686"></a>
+<span class="sourceLineNo">687</span>        }<a name="line.687"></a>
+<span class="sourceLineNo">688</span>        if (ex instanceof RemoteException) {<a name="line.688"></a>
+<span class="sourceLineNo">689</span>          throw (RemoteException) ex;<a name="line.689"></a>
+<span class="sourceLineNo">690</span>        }<a name="line.690"></a>
+<span class="sourceLineNo">691</span>        if (ex instanceof SaslException) {<a name="line.691"></a>
+<span class="sourceLineNo">692</span>          String msg = "SASL authentication failed." +<a name="line.692"></a>
+<span class="sourceLineNo">693</span>              " The most likely cause is missing or invalid credentials." +<a name="line.693"></a>
+<span class="sourceLineNo">694</span>              " Consider 'kinit'.";<a name="line.694"></a>
+<span class="sourceLineNo">695</span>          LOG.fatal(msg, ex);<a name="line.695"></a>
+<span class="sourceLineNo">696</span>          throw new RuntimeException(msg, ex);<a name="line.696"></a>
+<span class="sourceLineNo">697</span>        }<a name="line.697"></a>
+<span class="sourceLineNo">698</span>        throw new IOException(ex);<a name="line.698"></a>
+<span class="sourceLineNo">699</span>      }<a name="line.699"></a>
+<span class="sourceLineNo">700</span>    });<a name="line.700"></a>
+<span class="sourceLineNo">701</span>  }<a name="line.701"></a>
+<span class="sourceLineNo">702</span><a name="line.702"></a>
+<span class="sourceLineNo">703</span>  public int getConnectionHashCode() {<a name="line.703"></a>
+<span class="sourceLineNo">704</span>    return ConnectionId.hashCode(ticket, serviceName, address);<a name="line.704"></a>
+<span class="sourceLineNo">705</span>  }<a name="line.705"></a>
+<span class="sourceLineNo">706</span><a name="line.706"></a>
+<span class="sourceLineNo">707</span>  @Override<a name="line.707"></a>
+<span class="sourceLineNo">708</span>  public int hashCode() {<a name="line.708"></a>
+<span class="sourceLineNo">709</span>    return getConnectionHashCode();<a name="line.709"></a>
+<span class="sourceLineNo">710</span>  }<a name="line.710"></a>
+<span class="sourceLineNo">711</span><a name="line.711"></a>
+<span class="sourceLineNo">712</span>  @Override<a name="line.712"></a>
+<span class="sourceLineNo">713</span>  public boolean equals(Object obj) {<a name="line.713"></a>
+<span class="sourceLineNo">714</span>    if (obj instanceof AsyncRpcChannel) {<a name="line.714"></a>
+<span class="sourceLineNo">715</span>      AsyncRpcChannel channel = (AsyncRpcChannel) obj;<a name="line.715"></a>
+<span class="sourceLineNo">716</span>      return channel.hashCode() == obj.hashCode();<a name="line.716"></a>
+<span class="sourceLineNo">717</span>    }<a name="line.717"></a>
+<span class="sourceLineNo">718</span>    return false;<a name="line.718"></a>
+<span class="sourceLineNo">719</span>  }<a name="line.719"></a>
 <span class="sourceLineNo">720</span><a name="line.720"></a>
-<span class="sourceLineNo">721</span>  @Override<a name="line.721"></a>
-<span class="sourceLineNo">722</span>  public String toString() {<a name="line.722"></a>
-<span class="sourceLineNo">723</span>    return this.address.toString() + "/" + this.serviceName + "/" + this.ticket;<a name="line.723"></a>
-<span class="sourceLineNo">724</span>  }<a name="line.724"></a>
-<span class="sourceLineNo">725</span><a name="line.725"></a>
-<span class="sourceLineNo">726</span>  /**<a name="line.726"></a>
-<span class="sourceLineNo">727</span>   * Listens to call writes and fails if write failed<a name="line.727"></a>
-<span class="sourceLineNo">728</span>   */<a name="line.728"></a>
-<span class="sourceLineNo">729</span>  private static final class CallWriteListener implements ChannelFutureListener {<a name="line.729"></a>
-<span class="sourceLineNo">730</span>    private final AsyncRpcChannel rpcChannel;<a name="line.730"></a>
-<span class="sourceLineNo">731</span>    private final int id;<a name="line.731"></a>
-<span class="sourceLineNo">732</span><a name="line.732"></a>
-<span class="sourceLineNo">733</span>    public CallWriteListener(AsyncRpcChannel asyncRpcChannel, int id) {<a name="line.733"></a>
-<span class="sourceLineNo">734</span>      this.rpcChannel = asyncRpcChannel;<a name="line.734"></a>
-<span class="sourceLineNo">735</span>      this.id = id;<a name="line.735"></a>
-<span class="sourceLineNo">736</span>    }<a name="line.736"></a>
-<span class="sourceLineNo">737</span><a name="line.737"></a>
-<span class="sourceLineNo">738</span>    @Override<a name="line.738"></a>
-<span class="sourceLineNo">739</span>    public void operationComplete(ChannelFuture future) throws Exception {<a name="line.739"></a>
-<span class="sourceLineNo">740</span>      if (!future.isSuccess()) {<a name="line.740"></a>
-<span class="sourceLineNo">741</span>        AsyncCall call = rpcChannel.removePendingCall(id);<a name="line.741"></a>
-<span class="sourceLineNo">742</span>        if (call != null) {<a name="line.742"></a>
-<span class="sourceLineNo">743</span>          if (future.cause() instanceof IOException) {<a name="line.743"></a>
-<span class="sourceLineNo">744</span>            call.setFailed((IOException) future.cause());<a name="line.744"></a>
-<span class="sourceLineNo">745</span>          } else {<a name="line.745"></a>
-<span class="sourceLineNo">746</span>            call.setFailed(new IOException(future.cause()));<a name="line.746"></a>
-<span class="sourceLineNo">747</span>          }<a name="line.747"></a>
-<span class="sourceLineNo">748</span>        }<a name="line.748"></a>
-<span class="sourceLineNo">749</span>      }<a name="line.749"></a>
-<span class="sourceLineNo">750</span>    }<a name="line.750"></a>
-<span class="sourceLineNo">751</span>  }<a name="line.751"></a>
-<span class="sourceLineNo">752</span>}<a name="line.752"></a>
+<span class="sourceLineNo">721</span><a name="line.721"></a>
+<span class="sourceLineNo">722</span>  @Override<a name="line.722"></a>
+<span class="sourceLineNo">723</span>  public String toString() {<a name="line.723"></a>
+<span class="sourceLineNo">724</span>    return this.address.toString() + "/" + this.serviceName + "/" + this.ticket;<a name="line.724"></a>
+<span class="sourceLineNo">725</span>  }<a name="line.725"></a>
+<span class="sourceLineNo">726</span><a name="line.726"></a>
+<span class="sourceLineNo">727</span>  /**<a name="line.727"></a>
+<span class="sourceLineNo">728</span>   * Listens to call writes and fails if write failed<a name="line.728"></a>
+<span class="sourceLineNo">729</span>   */<a name="line.729"></a>
+<span class="sourceLineNo">730</span>  private static final class CallWriteListener implements ChannelFutureListener {<a name="line.730"></a>
+<span class="sourceLineNo">731</span>    private final AsyncRpcChannel rpcChannel;<a name="line.731"></a>
+<span class="sourceLineNo">732</span>    private final int id;<a name="line.732"></a>
+<span class="sourceLineNo">733</span><a name="line.733"></a>
+<span class="sourceLineNo">734</span>    public CallWriteListener(AsyncRpcChannel asyncRpcChannel, int id) {<a name="line.734"></a>
+<span class="sourceLineNo">735</span>      this.rpcChannel = asyncRpcChannel;<a name="line.735"></a>
+<span class="sourceLineNo">736</span>      this.id = id;<a name="line.736"></a>
+<span class="sourceLineNo">737</span>    }<a name="line.737"></a>
+<span class="sourceLineNo">738</span><a name="line.738"></a>
+<span class="sourceLineNo">739</span>    @Override<a name="line.739"></a>
+<span class="sourceLineNo">740</span>    public void operationComplete(ChannelFuture future) throws Exception {<a name="line.740"></a>
+<span class="sourceLineNo">741</span>      if (!future.isSuccess()) {<a name="line.741"></a>
+<span class="sourceLineNo">742</span>        AsyncCall call = rpcChannel.removePendingCall(id);<a name="line.742"></a>
+<span class="sourceLineNo">743</span>        if (call != null) {<a name="line.743"></a>
+<span class="sourceLineNo">744</span>          if (future.cause() instanceof IOException) {<a name="line.744"></a>
+<span class="sourceLineNo">745</span>            call.setFailed((IOException) future.cause());<a name="line.745"></a>
+<span class="sourceLineNo">746</span>          } else {<a name="line.746"></a>
+<span class="sourceLineNo">747</span>            call.setFailed(new IOException(future.cause()));<a name="line.747"></a>
+<span class="sourceLineNo">748</span>          }<a name="line.748"></a>
+<span class="sourceLineNo">749</span>        }<a name="line.749"></a>
+<span class="sourceLineNo">750</span>      }<a name="line.750"></a>
+<span class="sourceLineNo">751</span>    }<a name="line.751"></a>
+<span class="sourceLineNo">752</span>  }<a name="line.752"></a>
+<span class="sourceLineNo">753</span>}<a name="line.753"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/a8725a46/devapidocs/src-html/org/apache/hadoop/hbase/ipc/IPCUtil.CellScannerButNoCodecException.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/ipc/IPCUtil.CellScannerButNoCodecException.html b/devapidocs/src-html/org/apache/hadoop/hbase/ipc/IPCUtil.CellScannerButNoCodecException.html
index 1b5adb7..8f9e5a8 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/ipc/IPCUtil.CellScannerButNoCodecException.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/ipc/IPCUtil.CellScannerButNoCodecException.html
@@ -25,25 +25,25 @@
 <span class="sourceLineNo">017</span> */<a name="line.17"></a>
 <span class="sourceLineNo">018</span>package org.apache.hadoop.hbase.ipc;<a name="line.18"></a>
 <span class="sourceLineNo">019</span><a name="line.19"></a>
-<span class="sourceLineNo">020</span>import java.io.ByteArrayInputStream;<a name="line.20"></a>
-<span class="sourceLineNo">021</span>import java.io.DataInput;<a name="line.21"></a>
-<span class="sourceLineNo">022</span>import java.io.IOException;<a name="line.22"></a>
-<span class="sourceLineNo">023</span>import java.io.InputStream;<a name="line.23"></a>
-<span class="sourceLineNo">024</span>import java.io.OutputStream;<a name="line.24"></a>
-<span class="sourceLineNo">025</span>import java.nio.BufferOverflowException;<a name="line.25"></a>
-<span class="sourceLineNo">026</span>import java.nio.ByteBuffer;<a name="line.26"></a>
-<span class="sourceLineNo">027</span><a name="line.27"></a>
-<span class="sourceLineNo">028</span>import org.apache.commons.io.IOUtils;<a name="line.28"></a>
-<span class="sourceLineNo">029</span>import org.apache.commons.logging.Log;<a name="line.29"></a>
-<span class="sourceLineNo">030</span>import org.apache.commons.logging.LogFactory;<a name="line.30"></a>
-<span class="sourceLineNo">031</span>import org.apache.hadoop.hbase.classification.InterfaceAudience;<a name="line.31"></a>
-<span class="sourceLineNo">032</span>import org.apache.hadoop.conf.Configurable;<a name="line.32"></a>
-<span class="sourceLineNo">033</span>import org.apache.hadoop.conf.Configuration;<a name="line.33"></a>
-<span class="sourceLineNo">034</span>import org.apache.hadoop.hbase.CellScanner;<a name="line.34"></a>
-<span class="sourceLineNo">035</span>import org.apache.hadoop.hbase.DoNotRetryIOException;<a name="line.35"></a>
-<span class="sourceLineNo">036</span>import org.apache.hadoop.hbase.HBaseIOException;<a name="line.36"></a>
-<span class="sourceLineNo">037</span>import org.apache.hadoop.hbase.codec.Codec;<a name="line.37"></a>
-<span class="sourceLineNo">038</span>import org.apache.hadoop.hbase.io.BoundedByteBufferPool;<a name="line.38"></a>
+<span class="sourceLineNo">020</span>import java.io.DataInput;<a name="line.20"></a>
+<span class="sourceLineNo">021</span>import java.io.IOException;<a name="line.21"></a>
+<span class="sourceLineNo">022</span>import java.io.InputStream;<a name="line.22"></a>
+<span class="sourceLineNo">023</span>import java.io.OutputStream;<a name="line.23"></a>
+<span class="sourceLineNo">024</span>import java.nio.BufferOverflowException;<a name="line.24"></a>
+<span class="sourceLineNo">025</span>import java.nio.ByteBuffer;<a name="line.25"></a>
+<span class="sourceLineNo">026</span><a name="line.26"></a>
+<span class="sourceLineNo">027</span>import org.apache.commons.io.IOUtils;<a name="line.27"></a>
+<span class="sourceLineNo">028</span>import org.apache.commons.logging.Log;<a name="line.28"></a>
+<span class="sourceLineNo">029</span>import org.apache.commons.logging.LogFactory;<a name="line.29"></a>
+<span class="sourceLineNo">030</span>import org.apache.hadoop.hbase.classification.InterfaceAudience;<a name="line.30"></a>
+<span class="sourceLineNo">031</span>import org.apache.hadoop.conf.Configurable;<a name="line.31"></a>
+<span class="sourceLineNo">032</span>import org.apache.hadoop.conf.Configuration;<a name="line.32"></a>
+<span class="sourceLineNo">033</span>import org.apache.hadoop.hbase.CellScanner;<a name="line.33"></a>
+<span class="sourceLineNo">034</span>import org.apache.hadoop.hbase.DoNotRetryIOException;<a name="line.34"></a>
+<span class="sourceLineNo">035</span>import org.apache.hadoop.hbase.HBaseIOException;<a name="line.35"></a>
+<span class="sourceLineNo">036</span>import org.apache.hadoop.hbase.codec.Codec;<a name="line.36"></a>
+<span class="sourceLineNo">037</span>import org.apache.hadoop.hbase.io.BoundedByteBufferPool;<a name="line.37"></a>
+<span class="sourceLineNo">038</span>import org.apache.hadoop.hbase.io.ByteBufferInputStream;<a name="line.38"></a>
 <span class="sourceLineNo">039</span>import org.apache.hadoop.hbase.io.ByteBufferOutputStream;<a name="line.39"></a>
 <span class="sourceLineNo">040</span>import org.apache.hadoop.hbase.io.HeapSize;<a name="line.40"></a>
 <span class="sourceLineNo">041</span>import org.apache.hadoop.hbase.util.Bytes;<a name="line.41"></a>
@@ -188,136 +188,134 @@
 <span class="sourceLineNo">180</span>  public CellScanner createCellScanner(final Codec codec, final CompressionCodec compressor,<a name="line.180"></a>
 <span class="sourceLineNo">181</span>      final byte [] cellBlock)<a name="line.181"></a>
 <span class="sourceLineNo">182</span>  throws IOException {<a name="line.182"></a>
-<span class="sourceLineNo">183</span>    return createCellScanner(codec, compressor, cellBlock, 0, cellBlock.length);<a name="line.183"></a>
+<span class="sourceLineNo">183</span>    return createCellScanner(codec, compressor, ByteBuffer.wrap(cellBlock));<a name="line.183"></a>
 <span class="sourceLineNo">184</span>  }<a name="line.184"></a>
 <span class="sourceLineNo">185</span><a name="line.185"></a>
 <span class="sourceLineNo">186</span>  /**<a name="line.186"></a>
 <span class="sourceLineNo">187</span>   * @param codec<a name="line.187"></a>
-<span class="sourceLineNo">188</span>   * @param cellBlock<a name="line.188"></a>
-<span class="sourceLineNo">189</span>   * @param offset<a name="line.189"></a>
-<span class="sourceLineNo">190</span>   * @param length<a name="line.190"></a>
-<span class="sourceLineNo">191</span>   * @return CellScanner to work against the content of &lt;code&gt;cellBlock&lt;/code&gt;<a name="line.191"></a>
-<span class="sourceLineNo">192</span>   * @throws IOException<a name="line.192"></a>
-<span class="sourceLineNo">193</span>   */<a name="line.193"></a>
-<span class="sourceLineNo">194</span>  public CellScanner createCellScanner(final Codec codec, final CompressionCodec compressor,<a name="line.194"></a>
-<span class="sourceLineNo">195</span>      final byte [] cellBlock, final int offset, final int length)<a name="line.195"></a>
-<span class="sourceLineNo">196</span>  throws IOException {<a name="line.196"></a>
-<span class="sourceLineNo">197</span>    // If compressed, decompress it first before passing it on else we will leak compression<a name="line.197"></a>
-<span class="sourceLineNo">198</span>    // resources if the stream is not closed properly after we let it out.<a name="line.198"></a>
-<span class="sourceLineNo">199</span>    InputStream is = null;<a name="line.199"></a>
-<span class="sourceLineNo">200</span>    if (compressor != null) {<a name="line.200"></a>
-<span class="sourceLineNo">201</span>      // GZIPCodec fails w/ NPE if no configuration.<a name="line.201"></a>
-<span class="sourceLineNo">202</span>      if (compressor instanceof Configurable) ((Configurable)compressor).setConf(this.conf);<a name="line.202"></a>
-<span class="sourceLineNo">203</span>      Decompressor poolDecompressor = CodecPool.getDecompressor(compressor);<a name="line.203"></a>
-<span class="sourceLineNo">204</span>      CompressionInputStream cis =<a name="line.204"></a>
-<span class="sourceLineNo">205</span>        compressor.createInputStream(new ByteArrayInputStream(cellBlock, offset, length),<a name="line.205"></a>
-<span class="sourceLineNo">206</span>        poolDecompressor);<a name="line.206"></a>
-<span class="sourceLineNo">207</span>      ByteBufferOutputStream bbos = null;<a name="line.207"></a>
-<span class="sourceLineNo">208</span>      try {<a name="line.208"></a>
-<span class="sourceLineNo">209</span>        // TODO: This is ugly.  The buffer will be resized on us if we guess wrong.<a name="line.209"></a>
-<span class="sourceLineNo">210</span>        // TODO: Reuse buffers.<a name="line.210"></a>
-<span class="sourceLineNo">211</span>        bbos = new ByteBufferOutputStream((length - offset) *<a name="line.211"></a>
-<span class="sourceLineNo">212</span>          this.cellBlockDecompressionMultiplier);<a name="line.212"></a>
-<span class="sourceLineNo">213</span>        IOUtils.copy(cis, bbos);<a name="line.213"></a>
-<span class="sourceLineNo">214</span>        bbos.close();<a name="line.214"></a>
-<span class="sourceLineNo">215</span>        ByteBuffer bb = bbos.getByteBuffer();<a name="line.215"></a>
-<span class="sourceLineNo">216</span>        is = new ByteArrayInputStream(bb.array(), 0, bb.limit());<a name="line.216"></a>
-<span class="sourceLineNo">217</span>      } finally {<a name="line.217"></a>
-<span class="sourceLineNo">218</span>        if (is != null) is.close();<a name="line.218"></a>
-<span class="sourceLineNo">219</span>        if (bbos != null) bbos.close();<a name="line.219"></a>
-<span class="sourceLineNo">220</span><a name="line.220"></a>
-<span class="sourceLineNo">221</span>        CodecPool.returnDecompressor(poolDecompressor);<a name="line.221"></a>
-<span class="sourceLineNo">222</span>      }<a name="line.222"></a>
-<span class="sourceLineNo">223</span>    } else {<a name="line.223"></a>
-<span class="sourceLineNo">224</span>      is = new ByteArrayInputStream(cellBlock, offset, length);<a name="line.224"></a>
-<span class="sourceLineNo">225</span>    }<a name="line.225"></a>
-<span class="sourceLineNo">226</span>    return codec.getDecoder(is);<a name="line.226"></a>
-<span class="sourceLineNo">227</span>  }<a name="line.227"></a>
-<span class="sourceLineNo">228</span><a name="line.228"></a>
-<span class="sourceLineNo">229</span>  /**<a name="line.229"></a>
-<span class="sourceLineNo">230</span>   * @param m Message to serialize delimited; i.e. w/ a vint of its size preceeding its<a name="line.230"></a>
-<span class="sourceLineNo">231</span>   * serialization.<a name="line.231"></a>
-<span class="sourceLineNo">232</span>   * @return The passed in Message serialized with delimiter.  Return null if &lt;code&gt;m&lt;/code&gt; is null<a name="line.232"></a>
-<span class="sourceLineNo">233</span>   * @throws IOException<a name="line.233"></a>
-<span class="sourceLineNo">234</span>   */<a name="line.234"></a>
-<span class="sourceLineNo">235</span>  public static ByteBuffer getDelimitedMessageAsByteBuffer(final Message m) throws IOException {<a name="line.235"></a>
-<span class="sourceLineNo">236</span>    if (m == null) return null;<a name="line.236"></a>
-<span class="sourceLineNo">237</span>    int serializedSize = m.getSerializedSize();<a name="line.237"></a>
-<span class="sourceLineNo">238</span>    int vintSize = CodedOutputStream.computeRawVarint32Size(serializedSize);<a name="line.238"></a>
-<span class="sourceLineNo">239</span>    byte [] buffer = new byte[serializedSize + vintSize];<a name="line.239"></a>
-<span class="sourceLineNo">240</span>    // Passing in a byte array saves COS creating a buffer which it does when using streams.<a name="line.240"></a>
-<span class="sourceLineNo">241</span>    CodedOutputStream cos = CodedOutputStream.newInstance(buffer);<a name="line.241"></a>
-<span class="sourceLineNo">242</span>    // This will write out the vint preamble and the message serialized.<a name="line.242"></a>
-<span class="sourceLineNo">243</span>    cos.writeMessageNoTag(m);<a name="line.243"></a>
-<span class="sourceLineNo">244</span>    cos.flush();<a name="line.244"></a>
-<span class="sourceLineNo">245</span>    cos.checkNoSpaceLeft();<a name="line.245"></a>
-<span class="sourceLineNo">246</span>    return ByteBuffer.wrap(buffer);<a name="line.246"></a>
-<span class="sourceLineNo">247</span>  }<a name="line.247"></a>
-<span class="sourceLineNo">248</span><a name="line.248"></a>
-<span class="sourceLineNo">249</span>  /**<a name="line.249"></a>
-<span class="sourceLineNo">250</span>   * Write out header, param, and cell block if there is one.<a name="line.250"></a>
-<span class="sourceLineNo">251</span>   * @param dos<a name="line.251"></a>
-<span class="sourceLineNo">252</span>   * @param header<a name="line.252"></a>
-<span class="sourceLineNo">253</span>   * @param param<a name="line.253"></a>
-<span class="sourceLineNo">254</span>   * @param cellBlock<a name="line.254"></a>
-<span class="sourceLineNo">255</span>   * @return Total number of bytes written.<a name="line.255"></a>
-<span class="sourceLineNo">256</span>   * @throws IOException<a name="line.256"></a>
-<span class="sourceLineNo">257</span>   */<a name="line.257"></a>
-<span class="sourceLineNo">258</span>  public static int write(final OutputStream dos, final Message header, final Message param,<a name="line.258"></a>
-<span class="sourceLineNo">259</span>      final ByteBuffer cellBlock)<a name="line.259"></a>
-<span class="sourceLineNo">260</span>  throws IOException {<a name="line.260"></a>
-<span class="sourceLineNo">261</span>    // Must calculate total size and write that first so other side can read it all in in one<a name="line.261"></a>
-<span class="sourceLineNo">262</span>    // swoop.  This is dictated by how the server is currently written.  Server needs to change<a name="line.262"></a>
-<span class="sourceLineNo">263</span>    // if we are to be able to write without the length prefixing.<a name="line.263"></a>
-<span class="sourceLineNo">264</span>    int totalSize = IPCUtil.getTotalSizeWhenWrittenDelimited(header, param);<a name="line.264"></a>
-<span class="sourceLineNo">265</span>    if (cellBlock != null) totalSize += cellBlock.remaining();<a name="line.265"></a>
-<span class="sourceLineNo">266</span>    return write(dos, header, param, cellBlock, totalSize);<a name="line.266"></a>
-<span class="sourceLineNo">267</span>  }<a name="line.267"></a>
-<span class="sourceLineNo">268</span><a name="line.268"></a>
-<span class="sourceLineNo">269</span>  private static int write(final OutputStream dos, final Message header, final Message param,<a name="line.269"></a>
-<span class="sourceLineNo">270</span>    final ByteBuffer cellBlock, final int totalSize)<a name="line.270"></a>
-<span class="sourceLineNo">271</span>  throws IOException {<a name="line.271"></a>
-<span class="sourceLineNo">272</span>    // I confirmed toBytes does same as DataOutputStream#writeInt.<a name="line.272"></a>
-<span class="sourceLineNo">273</span>    dos.write(Bytes.toBytes(totalSize));<a name="line.273"></a>
-<span class="sourceLineNo">274</span>    // This allocates a buffer that is the size of the message internally.<a name="line.274"></a>
-<span class="sourceLineNo">275</span>    header.writeDelimitedTo(dos);<a name="line.275"></a>
-<span class="sourceLineNo">276</span>    if (param != null) param.writeDelimitedTo(dos);<a name="line.276"></a>
-<span class="sourceLineNo">277</span>    if (cellBlock != null) dos.write(cellBlock.array(), 0, cellBlock.remaining());<a name="line.277"></a>
-<span class="sourceLineNo">278</span>    dos.flush();<a name="line.278"></a>
-<span class="sourceLineNo">279</span>    return totalSize;<a name="line.279"></a>
-<span class="sourceLineNo">280</span>  }<a name="line.280"></a>
-<span class="sourceLineNo">281</span><a name="line.281"></a>
-<span class="sourceLineNo">282</span>  /**<a name="line.282"></a>
-<span class="sourceLineNo">283</span>   * Read in chunks of 8K (HBASE-7239)<a name="line.283"></a>
-<span class="sourceLineNo">284</span>   * @param in<a name="line.284"></a>
-<span class="sourceLineNo">285</span>   * @param dest<a name="line.285"></a>
-<span class="sourceLineNo">286</span>   * @param offset<a name="line.286"></a>
-<span class="sourceLineNo">287</span>   * @param len<a name="line.287"></a>
-<span class="sourceLineNo">288</span>   * @throws IOException<a name="line.288"></a>
-<span class="sourceLineNo">289</span>   */<a name="line.289"></a>
-<span class="sourceLineNo">290</span>  public static void readChunked(final DataInput in, byte[] dest, int offset, int len)<a name="line.290"></a>
-<span class="sourceLineNo">291</span>      throws IOException {<a name="line.291"></a>
-<span class="sourceLineNo">292</span>    int maxRead = 8192;<a name="line.292"></a>
-<span class="sourceLineNo">293</span><a name="line.293"></a>
-<span class="sourceLineNo">294</span>    for (; offset &lt; len; offset += maxRead) {<a name="line.294"></a>
-<span class="sourceLineNo">295</span>      in.readFully(dest, offset, Math.min(len - offset, maxRead));<a name="line.295"></a>
-<span class="sourceLineNo">296</span>    }<a name="line.296"></a>
-<span class="sourceLineNo">297</span>  }<a name="line.297"></a>
-<span class="sourceLineNo">298</span><a name="line.298"></a>
-<span class="sourceLineNo">299</span>  /**<a name="line.299"></a>
-<span class="sourceLineNo">300</span>   * @return Size on the wire when the two messages are written with writeDelimitedTo<a name="line.300"></a>
-<span class="sourceLineNo">301</span>   */<a name="line.301"></a>
-<span class="sourceLineNo">302</span>  public static int getTotalSizeWhenWrittenDelimited(Message ... messages) {<a name="line.302"></a>
-<span class="sourceLineNo">303</span>    int totalSize = 0;<a name="line.303"></a>
-<span class="sourceLineNo">304</span>    for (Message m: messages) {<a name="line.304"></a>
-<span class="sourceLineNo">305</span>      if (m == null) continue;<a name="line.305"></a>
-<span class="sourceLineNo">306</span>      totalSize += m.getSerializedSize();<a name="line.306"></a>
-<span class="sourceLineNo">307</span>      totalSize += CodedOutputStream.computeRawVarint32Size(m.getSerializedSize());<a name="line.307"></a>
-<span class="sourceLineNo">308</span>    }<a name="line.308"></a>
-<span class="sourceLineNo">309</span>    Preconditions.checkArgument(totalSize &lt; Integer.MAX_VALUE);<a name="line.309"></a>
-<span class="sourceLineNo">310</span>    return totalSize;<a name="line.310"></a>
-<span class="sourceLineNo">311</span>  }<a name="line.311"></a>
-<span class="sourceLineNo">312</span>}<a name="line.312"></a>
+<span class="sourceLineNo">188</span>   * @param cellBlock ByteBuffer containing the cells written by the Codec. The buffer should be<a name="line.188"></a>
+<span class="sourceLineNo">189</span>   * position()'ed at the start of the cell block and limit()'ed at the end.<a name="line.189"></a>
+<span class="sourceLineNo">190</span>   * @return CellScanner to work against the content of &lt;code&gt;cellBlock&lt;/code&gt;<a name="line.190"></a>
+<span class="sourceLineNo">191</span>   * @throws IOException<a name="line.191"></a>
+<span class="sourceLineNo">192</span>   */<a name="line.192"></a>
+<span class="sourceLineNo">193</span>  public CellScanner createCellScanner(final Codec codec, final CompressionCodec compressor,<a name="line.193"></a>
+<span class="sourceLineNo">194</span>      final ByteBuffer cellBlock)<a name="line.194"></a>
+<span class="sourceLineNo">195</span>  throws IOException {<a name="line.195"></a>
+<span class="sourceLineNo">196</span>    // If compressed, decompress it first before passing it on else we will leak compression<a name="line.196"></a>
+<span class="sourceLineNo">197</span>    // resources if the stream is not closed properly after we let it out.<a name="line.197"></a>
+<span class="sourceLineNo">198</span>    InputStream is = null;<a name="line.198"></a>
+<span class="sourceLineNo">199</span>    if (compressor != null) {<a name="line.199"></a>
+<span class="sourceLineNo">200</span>      // GZIPCodec fails w/ NPE if no configuration.<a name="line.200"></a>
+<span class="sourceLineNo">201</span>      if (compressor instanceof Configurable) ((Configurable)compressor).setConf(this.conf);<a name="line.201"></a>
+<span class="sourceLineNo">202</span>      Decompressor poolDecompressor = CodecPool.getDecompressor(compressor);<a name="line.202"></a>
+<span class="sourceLineNo">203</span>      CompressionInputStream cis =<a name="line.203"></a>
+<span class="sourceLineNo">204</span>        compressor.createInputStream(new ByteBufferInputStream(cellBlock), poolDecompressor);<a name="line.204"></a>
+<span class="sourceLineNo">205</span>      ByteBufferOutputStream bbos = null;<a name="line.205"></a>
+<span class="sourceLineNo">206</span>      try {<a name="line.206"></a>
+<span class="sourceLineNo">207</span>        // TODO: This is ugly.  The buffer will be resized on us if we guess wrong.<a name="line.207"></a>
+<span class="sourceLineNo">208</span>        // TODO: Reuse buffers.<a name="line.208"></a>
+<span class="sourceLineNo">209</span>        bbos = new ByteBufferOutputStream(cellBlock.remaining() *<a name="line.209"></a>
+<span class="sourceLineNo">210</span>          this.cellBlockDecompressionMultiplier);<a name="line.210"></a>
+<span class="sourceLineNo">211</span>        IOUtils.copy(cis, bbos);<a name="line.211"></a>
+<span class="sourceLineNo">212</span>        bbos.close();<a name="line.212"></a>
+<span class="sourceLineNo">213</span>        ByteBuffer bb = bbos.getByteBuffer();<a name="line.213"></a>
+<span class="sourceLineNo">214</span>        is = new ByteBufferInputStream(bb);<a name="line.214"></a>
+<span class="sourceLineNo">215</span>      } finally {<a name="line.215"></a>
+<span class="sourceLineNo">216</span>        if (is != null) is.close();<a name="line.216"></a>
+<span class="sourceLineNo">217</span>        if (bbos != null) bbos.close();<a name="line.217"></a>
+<span class="sourceLineNo">218</span><a name="line.218"></a>
+<span class="sourceLineNo">219</span>        CodecPool.returnDecompressor(poolDecompressor);<a name="line.219"></a>
+<span class="sourceLineNo">220</span>      }<a name="line.220"></a>
+<span class="sourceLineNo">221</span>    } else {<a name="line.221"></a>
+<span class="sourceLineNo">222</span>      is = new ByteBufferInputStream(cellBlock);<a name="line.222"></a>
+<span class="sourceLineNo">223</span>    }<a name="line.223"></a>
+<span class="sourceLineNo">224</span>    return codec.getDecoder(is);<a name="line.224"></a>
+<span class="sourceLineNo">225</span>  }<a name="line.225"></a>
+<span class="sourceLineNo">226</span><a name="line.226"></a>
+<span class="sourceLineNo">227</span>  /**<a name="line.227"></a>
+<span class="sourceLineNo">228</span>   * @param m Message to serialize delimited; i.e. w/ a vint of its size preceeding its<a name="line.228"></a>
+<span class="sourceLineNo">229</span>   * serialization.<a name="line.229"></a>
+<span class="sourceLineNo">230</span>   * @return The passed in Message serialized with delimiter.  Return null if &lt;code&gt;m&lt;/code&gt; is null<a name="line.230"></a>
+<span class="sourceLineNo">231</span>   * @throws IOException<a name="line.231"></a>
+<span class="sourceLineNo">232</span>   */<a name="line.232"></a>
+<span class="sourceLineNo">233</span>  public static ByteBuffer getDelimitedMessageAsByteBuffer(final Message m) throws IOException {<a name="line.233"></a>
+<span class="sourceLineNo">234</span>    if (m == null) return null;<a name="line.234"></a>
+<span class="sourceLineNo">235</span>    int serializedSize = m.getSerializedSize();<a name="line.235"></a>
+<span class="sourceLineNo">236</span>    int vintSize = CodedOutputStream.computeRawVarint32Size(serializedSize);<a name="line.236"></a>
+<span class="sourceLineNo">237</span>    byte [] buffer = new byte[serializedSize + vintSize];<a name="line.237"></a>
+<span class="sourceLineNo">238</span>    // Passing in a byte array saves COS creating a buffer which it does when using streams.<a name="line.238"></a>
+<span class="sourceLineNo">239</span>    CodedOutputStream cos = CodedOutputStream.newInstance(buffer);<a name="line.239"></a>
+<span class="sourceLineNo">240</span>    // This will write out the vint preamble and the message serialized.<a name="line.240"></a>
+<span class="sourceLineNo">241</span>    cos.writeMessageNoTag(m);<a name="line.241"></a>
+<span class="sourceLineNo">242</span>    cos.flush();<a name="line.242"></a>
+<span class="sourceLineNo">243</span>    cos.checkNoSpaceLeft();<a name="line.243"></a>
+<span class="sourceLineNo">244</span>    return ByteBuffer.wrap(buffer);<a name="line.244"></a>
+<span class="sourceLineNo">245</span>  }<a name="line.245"></a>
+<span class="sourceLineNo">246</span><a name="line.246"></a>
+<span class="sourceLineNo">247</span>  /**<a name="line.247"></a>
+<span class="sourceLineNo">248</span>   * Write out header, param, and cell block if there is one.<a name="line.248"></a>
+<span class="sourceLineNo">249</span>   * @param dos<a name="line.249"></a>
+<span class="sourceLineNo">250</span>   * @param header<a name="line.250"></a>
+<span class="sourceLineNo">251</span>   * @param param<a name="line.251"></a>
+<span class="sourceLineNo">252</span>   * @param cellBlock<a name="line.252"></a>
+<span class="sourceLineNo">253</span>   * @return Total number of bytes written.<a name="line.253"></a>
+<span class="sourceLineNo">254</span>   * @throws IOException<a name="line.254"></a>
+<span class="sourceLineNo">255</span>   */<a name="line.255"></a>
+<span class="sourceLineNo">256</span>  public static int write(final OutputStream dos, final Message header, final Message param,<a name="line.256"></a>
+<span class="sourceLineNo">257</span>      final ByteBuffer cellBlock)<a name="line.257"></a>
+<span class="sourceLineNo">258</span>  throws IOException {<a name="line.258"></a>
+<span class="sourceLineNo">259</span>    // Must calculate total size and write that first so other side can read it all in in one<a name="line.259"></a>
+<span class="sourceLineNo">260</span>    // swoop.  This is dictated by how the server is currently written.  Server needs to change<a name="line.260"></a>
+<span class="sourceLineNo">261</span>    // if we are to be able to write without the length prefixing.<a name="line.261"></a>
+<span class="sourceLineNo">262</span>    int totalSize = IPCUtil.getTotalSizeWhenWrittenDelimited(header, param);<a name="line.262"></a>
+<span class="sourceLineNo">263</span>    if (cellBlock != null) totalSize += cellBlock.remaining();<a name="line.263"></a>
+<span class="sourceLineNo">264</span>    return write(dos, header, param, cellBlock, totalSize);<a name="line.264"></a>
+<span class="sourceLineNo">265</span>  }<a name="line.265"></a>
+<span class="sourceLineNo">266</span><a name="line.266"></a>
+<span class="sourceLineNo">267</span>  private static int write(final OutputStream dos, final Message header, final Message param,<a name="line.267"></a>
+<span class="sourceLineNo">268</span>    final ByteBuffer cellBlock, final int totalSize)<a name="line.268"></a>
+<span class="sourceLineNo">269</span>  throws IOException {<a name="line.269"></a>
+<span class="sourceLineNo">270</span>    // I confirmed toBytes does same as DataOutputStream#writeInt.<a name="line.270"></a>
+<span class="sourceLineNo">271</span>    dos.write(Bytes.toBytes(totalSize));<a name="line.271"></a>
+<span class="sourceLineNo">272</span>    // This allocates a buffer that is the size of the message internally.<a name="line.272"></a>
+<span class="sourceLineNo">273</span>    header.writeDelimitedTo(dos);<a name="line.273"></a>
+<span class="sourceLineNo">274</span>    if (param != null) param.writeDelimitedTo(dos);<a name="line.274"></a>
+<span class="sourceLineNo">275</span>    if (cellBlock != null) dos.write(cellBlock.array(), 0, cellBlock.remaining());<a name="line.275"></a>
+<span class="sourceLineNo">276</span>    dos.flush();<a name="line.276"></a>
+<span class="sourceLineNo">277</span>    return totalSize;<a name="line.277"></a>
+<span class="sourceLineNo">278</span>  }<a name="line.278"></a>
+<span class="sourceLineNo">279</span><a name="line.279"></a>
+<span class="sourceLineNo">280</span>  /**<a name="line.280"></a>
+<span class="sourceLineNo">281</span>   * Read in chunks of 8K (HBASE-7239)<a name="line.281"></a>
+<span class="sourceLineNo">282</span>   * @param in<a name="line.282"></a>
+<span class="sourceLineNo">283</span>   * @param dest<a name="line.283"></a>
+<span class="sourceLineNo">284</span>   * @param offset<a name="line.284"></a>
+<span class="sourceLineNo">285</span>   * @param len<a name="line.285"></a>
+<span class="sourceLineNo">286</span>   * @throws IOException<a name="line.286"></a>
+<span class="sourceLineNo">287</span>   */<a name="line.287"></a>
+<span class="sourceLineNo">288</span>  public static void readChunked(final DataInput in, byte[] dest, int offset, int len)<a name="line.288"></a>
+<span class="sourceLineNo">289</span>      throws IOException {<a name="line.289"></a>
+<span class="sourceLineNo">290</span>    int maxRead = 8192;<a name="line.290"></a>
+<span class="sourceLineNo">291</span><a name="line.291"></a>
+<span class="sourceLineNo">292</span>    for (; offset &lt; len; offset += maxRead) {<a name="line.292"></a>
+<span class="sourceLineNo">293</span>      in.readFully(dest, offset, Math.min(len - offset, maxRead));<a name="line.293"></a>
+<span class="sourceLineNo">294</span>    }<a name="line.294"></a>
+<span class="sourceLineNo">295</span>  }<a name="line.295"></a>
+<span class="sourceLineNo">296</span><a name="line.296"></a>
+<span class="sourceLineNo">297</span>  /**<a name="line.297"></a>
+<span class="sourceLineNo">298</span>   * @return Size on the wire when the two messages are written with writeDelimitedTo<a name="line.298"></a>
+<span class="sourceLineNo">299</span>   */<a name="line.299"></a>
+<span class="sourceLineNo">300</span>  public static int getTotalSizeWhenWrittenDelimited(Message ... messages) {<a name="line.300"></a>
+<span class="sourceLineNo">301</span>    int totalSize = 0;<a name="line.301"></a>
+<span class="sourceLineNo">302</span>    for (Message m: messages) {<a name="line.302"></a>
+<span class="sourceLineNo">303</span>      if (m == null) continue;<a name="line.303"></a>
+<span class="sourceLineNo">304</span>      totalSize += m.getSerializedSize();<a name="line.304"></a>
+<span class="sourceLineNo">305</span>      totalSize += CodedOutputStream.computeRawVarint32Size(m.getSerializedSize());<a name="line.305"></a>
+<span class="sourceLineNo">306</span>    }<a name="line.306"></a>
+<span class="sourceLineNo">307</span>    Preconditions.checkArgument(totalSize &lt; Integer.MAX_VALUE);<a name="line.307"></a>
+<span class="sourceLineNo">308</span>    return totalSize;<a name="line.308"></a>
+<span class="sourceLineNo">309</span>  }<a name="line.309"></a>
+<span class="sourceLineNo">310</span>}<a name="line.310"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/a8725a46/devapidocs/src-html/org/apache/hadoop/hbase/ipc/IPCUtil.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/ipc/IPCUtil.html b/devapidocs/src-html/org/apache/hadoop/hbase/ipc/IPCUtil.html
index 1b5adb7..8f9e5a8 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/ipc/IPCUtil.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/ipc/IPCUtil.html
@@ -25,25 +25,25 @@
 <span class="sourceLineNo">017</span> */<a name="line.17"></a>
 <span class="sourceLineNo">018</span>package org.apache.hadoop.hbase.ipc;<a name="line.18"></a>
 <span class="sourceLineNo">019</span><a name="line.19"></a>
-<span class="sourceLineNo">020</span>import java.io.ByteArrayInputStream;<a name="line.20"></a>
-<span class="sourceLineNo">021</span>import java.io.DataInput;<a name="line.21"></a>
-<span class="sourceLineNo">022</span>import java.io.IOException;<a name="line.22"></a>
-<span class="sourceLineNo">023</span>import java.io.InputStream;<a name="line.23"></a>
-<span class="sourceLineNo">024</span>import java.io.OutputStream;<a name="line.24"></a>
-<span class="sourceLineNo">025</span>import java.nio.BufferOverflowException;<a name="line.25"></a>
-<span class="sourceLineNo">026</span>import java.nio.ByteBuffer;<a name="line.26"></a>
-<span class="sourceLineNo">027</span><a name="line.27"></a>
-<span class="sourceLineNo">028</span>import org.apache.commons.io.IOUtils;<a name="line.28"></a>
-<span class="sourceLineNo">029</span>import org.apache.commons.logging.Log;<a name="line.29"></a>
-<span class="sourceLineNo">030</span>import org.apache.commons.logging.LogFactory;<a name="line.30"></a>
-<span class="sourceLineNo">031</span>import org.apache.hadoop.hbase.classification.InterfaceAudience;<a name="line.31"></a>
-<span class="sourceLineNo">032</span>import org.apache.hadoop.conf.Configurable;<a name="line.32"></a>
-<span class="sourceLineNo">033</span>import org.apache.hadoop.conf.Configuration;<a name="line.33"></a>
-<span class="sourceLineNo">034</span>import org.apache.hadoop.hbase.CellScanner;<a name="line.34"></a>
-<span class="sourceLineNo">035</span>import org.apache.hadoop.hbase.DoNotRetryIOException;<a name="line.35"></a>
-<span class="sourceLineNo">036</span>import org.apache.hadoop.hbase.HBaseIOException;<a name="line.36"></a>
-<span class="sourceLineNo">037</span>import org.apache.hadoop.hbase.codec.Codec;<a name="line.37"></a>
-<span class="sourceLineNo">038</span>import org.apache.hadoop.hbase.io.BoundedByteBufferPool;<a name="line.38"></a>
+<span class="sourceLineNo">020</span>import java.io.DataInput;<a name="line.20"></a>
+<span class="sourceLineNo">021</span>import java.io.IOException;<a name="line.21"></a>
+<span class="sourceLineNo">022</span>import java.io.InputStream;<a name="line.22"></a>
+<span class="sourceLineNo">023</span>import java.io.OutputStream;<a name="line.23"></a>
+<span class="sourceLineNo">024</span>import java.nio.BufferOverflowException;<a name="line.24"></a>
+<span class="sourceLineNo">025</span>import java.nio.ByteBuffer;<a name="line.25"></a>
+<span class="sourceLineNo">026</span><a name="line.26"></a>
+<span class="sourceLineNo">027</span>import org.apache.commons.io.IOUtils;<a name="line.27"></a>
+<span class="sourceLineNo">028</span>import org.apache.commons.logging.Log;<a name="line.28"></a>
+<span class="sourceLineNo">029</span>import org.apache.commons.logging.LogFactory;<a name="line.29"></a>
+<span class="sourceLineNo">030</span>import org.apache.hadoop.hbase.classification.InterfaceAudience;<a name="line.30"></a>
+<span class="sourceLineNo">031</span>import org.apache.hadoop.conf.Configurable;<a name="line.31"></a>
+<span class="sourceLineNo">032</span>import org.apache.hadoop.conf.Configuration;<a name="line.32"></a>
+<span class="sourceLineNo">033</span>import org.apache.hadoop.hbase.CellScanner;<a name="line.33"></a>
+<span class="sourceLineNo">034</span>import org.apache.hadoop.hbase.DoNotRetryIOException;<a name="line.34"></a>
+<span class="sourceLineNo">035</span>import org.apache.hadoop.hbase.HBaseIOException;<a name="line.35"></a>
+<span class="sourceLineNo">036</span>import org.apache.hadoop.hbase.codec.Codec;<a name="line.36"></a>
+<span class="sourceLineNo">037</span>import org.apache.hadoop.hbase.io.BoundedByteBufferPool;<a name="line.37"></a>
+<span class="sourceLineNo">038</span>import org.apache.hadoop.hbase.io.ByteBufferInputStream;<a name="line.38"></a>
 <span class="sourceLineNo">039</span>import org.apache.hadoop.hbase.io.ByteBufferOutputStream;<a name="line.39"></a>
 <span class="sourceLineNo">040</span>import org.apache.hadoop.hbase.io.HeapSize;<a name="line.40"></a>
 <span class="sourceLineNo">041</span>import org.apache.hadoop.hbase.util.Bytes;<a name="line.41"></a>
@@ -188,136 +188,134 @@
 <span class="sourceLineNo">180</span>  public CellScanner createCellScanner(final Codec codec, final CompressionCodec compressor,<a name="line.180"></a>
 <span class="sourceLineNo">181</span>      final byte [] cellBlock)<a name="line.181"></a>
 <span class="sourceLineNo">182</span>  throws IOException {<a name="line.182"></a>
-<span class="sourceLineNo">183</span>    return createCellScanner(codec, compressor, cellBlock, 0, cellBlock.length);<a name="line.183"></a>
+<span class="sourceLineNo">183</span>    return createCellScanner(codec, compressor, ByteBuffer.wrap(cellBlock));<a name="line.183"></a>
 <span class="sourceLineNo">184</span>  }<a name="line.184"></a>
 <span class="sourceLineNo">185</span><a name="line.185"></a>
 <span class="sourceLineNo">186</span>  /**<a name="line.186"></a>
 <span class="sourceLineNo">187</span>   * @param codec<a name="line.187"></a>
-<span class="sourceLineNo">188</span>   * @param cellBlock<a name="line.188"></a>
-<span class="sourceLineNo">189</span>   * @param offset<a name="line.189"></a>
-<span class="sourceLineNo">190</span>   * @param length<a name="line.190"></a>
-<span class="sourceLineNo">191</span>   * @return CellScanner to work against the content of &lt;code&gt;cellBlock&lt;/code&gt;<a name="line.191"></a>
-<span class="sourceLineNo">192</span>   * @throws IOException<a name="line.192"></a>
-<span class="sourceLineNo">193</span>   */<a name="line.193"></a>
-<span class="sourceLineNo">194</span>  public CellScanner createCellScanner(final Codec codec, final CompressionCodec compressor,<a name="line.194"></a>
-<span class="sourceLineNo">195</span>      final byte [] cellBlock, final int offset, final int length)<a name="line.195"></a>
-<span class="sourceLineNo">196</span>  throws IOException {<a name="line.196"></a>
-<span class="sourceLineNo">197</span>    // If compressed, decompress it first before passing it on else we will leak compression<a name="line.197"></a>
-<span class="sourceLineNo">198</span>    // resources if the stream is not closed properly after we let it out.<a name="line.198"></a>
-<span class="sourceLineNo">199</span>    InputStream is = null;<a name="line.199"></a>
-<span class="sourceLineNo">200</span>    if (compressor != null) {<a name="line.200"></a>
-<span class="sourceLineNo">201</span>      // GZIPCodec fails w/ NPE if no configuration.<a name="line.201"></a>
-<span class="sourceLineNo">202</span>      if (compressor instanceof Configurable) ((Configurable)compressor).setConf(this.conf);<a name="line.202"></a>
-<span class="sourceLineNo">203</span>      Decompressor poolDecompressor = CodecPool.getDecompressor(compressor);<a name="line.203"></a>
-<span class="sourceLineNo">204</span>      CompressionInputStream cis =<a name="line.204"></a>
-<span class="sourceLineNo">205</span>        compressor.createInputStream(new ByteArrayInputStream(cellBlock, offset, length),<a name="line.205"></a>
-<span class="sourceLineNo">206</span>        poolDecompressor);<a name="line.206"></a>
-<span class="sourceLineNo">207</span>      ByteBufferOutputStream bbos = null;<a name="line.207"></a>
-<span class="sourceLineNo">208</span>      try {<a name="line.208"></a>
-<span class="sourceLineNo">209</span>        // TODO: This is ugly.  The buffer will be resized on us if we guess wrong.<a name="line.209"></a>
-<span class="sourceLineNo">210</span>        // TODO: Reuse buffers.<a name="line.210"></a>
-<span class="sourceLineNo">211</span>        bbos = new ByteBufferOutputStream((length - offset) *<a name="line.211"></a>
-<span class="sourceLineNo">212</span>          this.cellBlockDecompressionMultiplier);<a name="line.212"></a>
-<span class="sourceLineNo">213</span>        IOUtils.copy(cis, bbos);<a name="line.213"></a>
-<span class="sourceLineNo">214</span>        bbos.close();<a name="line.214"></a>
-<span class="sourceLineNo">215</span>        ByteBuffer bb = bbos.getByteBuffer();<a name="line.215"></a>
-<span class="sourceLineNo">216</span>        is = new ByteArrayInputStream(bb.array(), 0, bb.limit());<a name="line.216"></a>
-<span class="sourceLineNo">217</span>      } finally {<a name="line.217"></a>
-<span class="sourceLineNo">218</span>        if (is != null) is.close();<a name="line.218"></a>
-<span class="sourceLineNo">219</span>        if (bbos != null) bbos.close();<a name="line.219"></a>
-<span class="sourceLineNo">220</span><a name="line.220"></a>
-<span class="sourceLineNo">221</span>        CodecPool.returnDecompressor(poolDecompressor);<a name="line.221"></a>
-<span class="sourceLineNo">222</span>      }<a name="line.222"></a>
-<span class="sourceLineNo">223</span>    } else {<a name="line.223"></a>
-<span class="sourceLineNo">224</span>      is = new ByteArrayInputStream(cellBlock, offset, length);<a name="line.224"></a>
-<span class="sourceLineNo">225</span>    }<a name="line.225"></a>
-<span class="sourceLineNo">226</span>    return codec.getDecoder(is);<a name="line.226"></a>
-<span class="sourceLineNo">227</span>  }<a name="line.227"></a>
-<span class="sourceLineNo">228</span><a name="line.228"></a>
-<span class="sourceLineNo">229</span>  /**<a name="line.229"></a>
-<span class="sourceLineNo">230</span>   * @param m Message to serialize delimited; i.e. w/ a vint of its size preceeding its<a name="line.230"></a>
-<span class="sourceLineNo">231</span>   * serialization.<a name="line.231"></a>
-<span class="sourceLineNo">232</span>   * @return The passed in Message serialized with delimiter.  Return null if &lt;code&gt;m&lt;/code&gt; is null<a name="line.232"></a>
-<span class="sourceLineNo">233</span>   * @throws IOException<a name="line.233"></a>
-<span class="sourceLineNo">234</span>   */<a name="line.234"></a>
-<span class="sourceLineNo">235</span>  public static ByteBuffer getDelimitedMessageAsByteBuffer(final Message m) throws IOException {<a name="line.235"></a>
-<span class="sourceLineNo">236</span>    if (m == null) return null;<a name="line.236"></a>
-<span class="sourceLineNo">237</span>    int serializedSize = m.getSerializedSize();<a name="line.237"></a>
-<span class="sourceLineNo">238</span>    int vintSize = CodedOutputStream.computeRawVarint32Size(serializedSize);<a name="line.238"></a>
-<span class="sourceLineNo">239</span>    byte [] buffer = new byte[serializedSize + vintSize];<a name="line.239"></a>
-<span class="sourceLineNo">240</span>    // Passing in a byte array saves COS creating a buffer which it does when using streams.<a name="line.240"></a>
-<span class="sourceLineNo">241</span>    CodedOutputStream cos = CodedOutputStream.newInstance(buffer);<a name="line.241"></a>
-<span class="sourceLineNo">242</span>    // This will write out the vint preamble and the message serialized.<a name="line.242"></a>
-<span class="sourceLineNo">243</span>    cos.writeMessageNoTag(m);<a name="line.243"></a>
-<span class="sourceLineNo">244</span>    cos.flush();<a name="line.244"></a>
-<span class="sourceLineNo">245</span>    cos.checkNoSpaceLeft();<a name="line.245"></a>
-<span class="sourceLineNo">246</span>    return ByteBuffer.wrap(buffer);<a name="line.246"></a>
-<span class="sourceLineNo">247</span>  }<a name="line.247"></a>
-<span class="sourceLineNo">248</span><a name="line.248"></a>
-<span class="sourceLineNo">249</span>  /**<a name="line.249"></a>
-<span class="sourceLineNo">250</span>   * Write out header, param, and cell block if there is one.<a name="line.250"></a>
-<span class="sourceLineNo">251</span>   * @param dos<a name="line.251"></a>
-<span class="sourceLineNo">252</span>   * @param header<a name="line.252"></a>
-<span class="sourceLineNo">253</span>   * @param param<a name="line.253"></a>
-<span class="sourceLineNo">254</span>   * @param cellBlock<a name="line.254"></a>
-<span class="sourceLineNo">255</span>   * @return Total number of bytes written.<a name="line.255"></a>
-<span class="sourceLineNo">256</span>   * @throws IOException<a name="line.256"></a>
-<span class="sourceLineNo">257</span>   */<a name="line.257"></a>
-<span class="sourceLineNo">258</span>  public static int write(final OutputStream dos, final Message header, final Message param,<a name="line.258"></a>
-<span class="sourceLineNo">259</span>      final ByteBuffer cellBlock)<a name="line.259"></a>
-<span class="sourceLineNo">260</span>  throws IOException {<a name="line.260"></a>
-<span class="sourceLineNo">261</span>    // Must calculate total size and write that first so other side can read it all in in one<a name="line.261"></a>
-<span class="sourceLineNo">262</span>    // swoop.  This is dictated by how the server is currently written.  Server needs to change<a name="line.262"></a>
-<span class="sourceLineNo">263</span>    // if we are to be able to write without the length prefixing.<a name="line.263"></a>
-<span class="sourceLineNo">264</span>    int totalSize = IPCUtil.getTotalSizeWhenWrittenDelimited(header, param);<a name="line.264"></a>
-<span class="sourceLineNo">265</span>    if (cellBlock != null) totalSize += cellBlock.remaining();<a name="line.265"></a>
-<span class="sourceLineNo">266</span>    return write(dos, header, param, cellBlock, totalSize);<a name="line.266"></a>
-<span class="sourceLineNo">267</span>  }<a name="line.267"></a>
-<span class="sourceLineNo">268</span><a name="line.268"></a>
-<span class="sourceLineNo">269</span>  private static int write(final OutputStream dos, final Message header, final Message param,<a name="line.269"></a>
-<span class="sourceLineNo">270</span>    final ByteBuffer cellBlock, final int totalSize)<a name="line.270"></a>
-<span class="sourceLineNo">271</span>  throws IOException {<a name="line.271"></a>
-<span class="sourceLineNo">272</span>    // I confirmed toBytes does same as DataOutputStream#writeInt.<a name="line.272"></a>
-<span class="sourceLineNo">273</span>    dos.write(Bytes.toBytes(totalSize));<a name="line.273"></a>
-<span class="sourceLineNo">274</span>    // This allocates a buffer that is the size of the message internally.<a name="line.274"></a>
-<span class="sourceLineNo">275</span>    header.writeDelimitedTo(dos);<a name="line.275"></a>
-<span class="sourceLineNo">276</span>    if (param != null) param.writeDelimitedTo(dos);<a name="line.276"></a>
-<span class="sourceLineNo">277</span>    if (cellBlock != null) dos.write(cellBlock.array(), 0, cellBlock.remaining());<a name="line.277"></a>
-<span class="sourceLineNo">278</span>    dos.flush();<a name="line.278"></a>
-<span class="sourceLineNo">279</span>    return totalSize;<a name="line.279"></a>
-<span class="sourceLineNo">280</span>  }<a name="line.280"></a>
-<span class="sourceLineNo">281</span><a name="line.281"></a>
-<span class="sourceLineNo">282</span>  /**<a name="line.282"></a>
-<span class="sourceLineNo">283</span>   * Read in chunks of 8K (HBASE-7239)<a name="line.283"></a>
-<span class="sourceLineNo">284</span>   * @param in<a name="line.284"></a>
-<span class="sourceLineNo">285</span>   * @param dest<a name="line.285"></a>
-<span class="sourceLineNo">286</span>   * @param offset<a name="line.286"></a>
-<span class="sourceLineNo">287</span>   * @param len<a name="line.287"></a>
-<span class="sourceLineNo">288</span>   * @throws IOException<a name="line.288"></a>
-<span class="sourceLineNo">289</span>   */<a name="line.289"></a>
-<span class="sourceLineNo">290</span>  public static void readChunked(final DataInput in, byte[] dest, int offset, int len)<a name="line.290"></a>
-<span class="sourceLineNo">291</span>      throws IOException {<a name="line.291"></a>
-<span class="sourceLineNo">292</span>    int maxRead = 8192;<a name="line.292"></a>
-<span class="sourceLineNo">293</span><a name="line.293"></a>
-<span class="sourceLineNo">294</span>    for (; offset &lt; len; offset += maxRead) {<a name="line.294"></a>
-<span class="sourceLineNo">295</span>      in.readFully(dest, offset, Math.min(len - offset, maxRead));<a name="line.295"></a>
-<span class="sourceLineNo">296</span>    }<a name="line.296"></a>
-<span class="sourceLineNo">297</span>  }<a name="line.297"></a>
-<span class="sourceLineNo">298</span><a name="line.298"></a>
-<span class="sourceLineNo">299</span>  /**<a name="line.299"></a>
-<span class="sourceLineNo">300</span>   * @return Size on the wire when the two messages are written with writeDelimitedTo<a name="line.300"></a>
-<span class="sourceLineNo">301</span>   */<a name="line.301"></a>
-<span class="sourceLineNo">302</span>  public static int getTotalSizeWhenWrittenDelimited(Message ... messages) {<a name="line.302"></a>
-<span class="sourceLineNo">303</span>    int totalSize = 0;<a name="line.303"></a>
-<span class="sourceLineNo">304</span>    for (Message m: messages) {<a name="line.304"></a>
-<span class="sourceLineNo">305</span>      if (m == null) continue;<a name="line.305"></a>
-<span class="sourceLineNo">306</span>      totalSize += m.getSerializedSize();<a name="line.306"></a>
-<span class="sourceLineNo">307</span>      totalSize += CodedOutputStream.computeRawVarint32Size(m.getSerializedSize());<a name="line.307"></a>
-<span class="sourceLineNo">308</span>    }<a name="line.308"></a>
-<span class="sourceLineNo">309</span>    Preconditions.checkArgument(totalSize &lt; Integer.MAX_VALUE);<a name="line.309"></a>
-<span class="sourceLineNo">310</span>    return totalSize;<a name="line.310"></a>
-<span class="sourceLineNo">311</span>  }<a name="line.311"></a>
-<span class="sourceLineNo">312</span>}<a name="line.312"></a>
+<span class="sourceLineNo">188</span>   * @param cellBlock ByteBuffer containing the cells written by the Codec. The buffer should be<a name="line.188"></a>
+<span class="sourceLineNo">189</span>   * position()'ed at the start of the cell block and limit()'ed at the end.<a name="line.189"></a>
+<span class="sourceLineNo">190</span>   * @return CellScanner to work against the content of &lt;code&gt;cellBlock&lt;/code&gt;<a name="line.190"></a>
+<span class="sourceLineNo">191</span>   * @throws IOException<a name="line.191"></a>
+<span class="sourceLineNo">192</span>   */<a name="line.192"></a>
+<span class="sourceLineNo">193</span>  public CellScanner createCellScanner(final Codec codec, final CompressionCodec compressor,<a name="line.193"></a>
+<span class="sourceLineNo">194</span>      final ByteBuffer cellBlock)<a name="line.194"></a>
+<span class="sourceLineNo">195</span>  throws IOException {<a name="line.195"></a>
+<span class="sourceLineNo">196</span>    // If compressed, decompress it first before passing it on else we will leak compression<a name="line.196"></a>
+<span class="sourceLineNo">197</span>    // resources if the stream is not closed properly after we let it out.<a name="line.197"></a>
+<span class="sourceLineNo">198</span>    InputStream is = null;<a name="line.198"></a>
+<span class="sourceLineNo">199</span>    if (compressor != null) {<a name="line.199"></a>
+<span class="sourceLineNo">200</span>      // GZIPCodec fails w/ NPE if no configuration.<a name="line.200"></a>
+<span class="sourceLineNo">201</span>      if (compressor instanceof Configurable) ((Configurable)compressor).setConf(this.conf);<a name="line.201"></a>
+<span class="sourceLineNo">202</span>      Decompressor poolDecompressor = CodecPool.getDecompressor(compressor);<a name="line.202"></a>
+<span class="sourceLineNo">203</span>      CompressionInputStream cis =<a name="line.203"></a>
+<span class="sourceLineNo">204</span>        compressor.createInputStream(new ByteBufferInputStream(cellBlock), poolDecompressor);<a name="line.204"></a>
+<span class="sourceLineNo">205</span>      ByteBufferOutputStream bbos = null;<a name="line.205"></a>
+<span class="sourceLineNo">206</span>      try {<a name="line.206"></a>
+<span class="sourceLineNo">207</span>        // TODO: This is ugly.  The buffer will be resized on us if we guess wrong.<a name="line.207"></a>
+<span class="sourceLineNo">208</span>        // TODO: Reuse buffers.<a name="line.208"></a>
+<span class="sourceLineNo">209</span>        bbos = new ByteBufferOutputStream(cellBlock.remaining() *<a name="line.209"></a>
+<span class="sourceLineNo">210</span>          this.cellBlockDecompressionMultiplier);<a name="line.210"></a>
+<span class="sourceLineNo">211</span>        IOUtils.copy(cis, bbos);<a name="line.211"></a>
+<span class="sourceLineNo">212</span>        bbos.close();<a name="line.212"></a>
+<span class="sourceLineNo">213</span>        ByteBuffer bb = bbos.getByteBuffer();<a name="line.213"></a>
+<span class="sourceLineNo">214</span>        is = new ByteBufferInputStream(bb);<a name="line.214"></a>
+<span class="sourceLineNo">215</span>      } finally {<a name="line.215"></a>
+<span class="sourceLineNo">216</span>        if (is != null) is.close();<a name="line.216"></a>
+<span class="sourceLineNo">217</span>        if (bbos != null) bbos.close();<a name="line.217"></a>
+<span class="sourceLineNo">218</span><a name="line.218"></a>
+<span class="sourceLineNo">219</span>        CodecPool.returnDecompressor(poolDecompressor);<a name="line.219"></a>
+<span class="sourceLineNo">220</span>      }<a name="line.220"></a>
+<span class="sourceLineNo">221</span>    } else {<a name="line.221"></a>
+<span class="sourceLineNo">222</span>      is = new ByteBufferInputStream(cellBlock);<a name="line.222"></a>
+<span class="sourceLineNo">223</span>    }<a name="line.223"></a>
+<span class="sourceLineNo">224</span>    return codec.getDecoder(is);<a name="line.224"></a>
+<span class="sourceLineNo">225</span>  }<a name="line.225"></a>
+<span class="sourceLineNo">226</span><a name="line.226"></a>
+<span class="sourceLineNo">227</span>  /**<a name="line.227"></a>
+<span class="sourceLineNo">228</span>   * @param m Message to serialize delimited; i.e. w/ a vint of its size preceeding its<a name="line.228"></a>
+<span class="sourceLineNo">229</span>   * serialization.<a name="line.229"></a>
+<span class="sourceLineNo">230</span>   * @return The passed in Message serialized with delimiter.  Return null if &lt;code&gt;m&lt;/code&gt; is null<a name="line.230"></a>
+<span class="sourceLineNo">231</span>   * @throws IOException<a name="line.231"></a>
+<span class="sourceLineNo">232</span>   */<a name="line.232"></a>
+<span class="sourceLineNo">233</span>  public static ByteBuffer getDelimitedMessageAsByteBuffer(final Message m) throws IOException {<a name="line.233"></a>
+<span class="sourceLineNo">234</span>    if (m == null) return null;<a name="line.234"></a>
+<span class="sourceLineNo">235</span>    int serializedSize = m.getSerializedSize();<a name="line.235"></a>
+<span class="sourceLineNo">236</span>    int vintSize = CodedOutputStream.computeRawVarint32Size(serializedSize);<a name="line.236"></a>
+<span class="sourceLineNo">237</span>    byte [] buffer = new byte[serializedSize + vintSize];<a name="line.237"></a>
+<span class="sourceLineNo">238</span>    // Passing in a byte array saves COS creating a buffer which it does when using streams.<a name="line.238"></a>
+<span class="sourceLineNo">239</span>    CodedOutputStream cos = CodedOutputStream.newInstance(buffer);<a name="line.239"></a>
+<span class="sourceLineNo">240</span>    // This will write out the vint preamble and the message serialized.<a name="line.240"></a>
+<span class="sourceLineNo">241</span>    cos.writeMessageNoTag(m);<a name="line.241"></a>
+<span class="sourceLineNo">242</span>    cos.flush();<a name="line.242"></a>
+<span class="sourceLineNo">243</span>    cos.checkNoSpaceLeft();<a name="line.243"></a>
+<span class="sourceLineNo">244</span>    return ByteBuffer.wrap(buffer);<a name="line.244"></a>
+<span class="sourceLineNo">245</span>  }<a name="line.245"></a>
+<span class="sourceLineNo">246</span><a name="line.246"></a>
+<span class="sourceLineNo">247</span>  /**<a name="line.247"></a>
+<span class="sourceLineNo">248</span>   * Write out header, param, and cell block if there is one.<a name="line.248"></a>
+<span class="sourceLineNo">249</span>   * @param dos<a name="line.249"></a>
+<span class="sourceLineNo">250</span>   * @param header<a name="line.250"></a>
+<span class="sourceLineNo">251</span>   * @param param<a name="line.251"></a>
+<span class="sourceLineNo">252</span>   * @param cellBlock<a name="line.252"></a>
+<span class="sourceLineNo">253</span>   * @return Total number of bytes written.<a name="line.253"></a>
+<span class="sourceLineNo">254</span>   * @throws IOException<a name="line.254"></a>
+<span class="sourceLineNo">255</span>   */<a name="line.255"></a>
+<span class="sourceLineNo">256</span>  public static int write(final OutputStream dos, final Message header, final Message param,<a name="line.256"></a>
+<span class="sourceLineNo">257</span>      final ByteBuffer cellBlock)<a name="line.257"></a>
+<span class="sourceLineNo">258</span>  throws IOException {<a name="line.258"></a>
+<span class="sourceLineNo">259</span>    // Must calculate total size and write that first so other side can read it all in in one<a name="line.259"></a>
+<span class="sourceLineNo">260</span>    // swoop.  This is dictated by how the server is currently written.  Server needs to change<a name="line.260"></a>
+<span class="sourceLineNo">261</span>    // if we are to be able to write without the length prefixing.<a name="line.261"></a>
+<span class="sourceLineNo">262</span>    int totalSize = IPCUtil.getTotalSizeWhenWrittenDelimited(header, param);<a name="line.262"></a>
+<span class="sourceLineNo">263</span>    if (cellBlock != null) totalSize += cellBlock.remaining();<a name="line.263"></a>
+<span class="sourceLineNo">264</span>    return write(dos, header, param, cellBlock, totalSize);<a name="line.264"></a>
+<span class="sourceLineNo">265</span>  }<a name="line.265"></a>
+<span class="sourceLineNo">266</span><a name="line.266"></a>
+<span class="sourceLineNo">267</span>  private static int write(final OutputStream dos, final Message header, final Message param,<a name="line.267"></a>
+<span class="sourceLineNo">268</span>    final ByteBuffer cellBlock, final int totalSize)<a name="line.268"></a>
+<span class="sourceLineNo">269</span>  throws IOException {<a name="line.269"></a>
+<span class="sourceLineNo">270</span>    // I confirmed toBytes does same as DataOutputStream#writeInt.<a name="line.270"></a>
+<span class="sourceLineNo">271</span>    dos.write(Bytes.toBytes(totalSize));<a name="line.271"></a>
+<span class="sourceLineNo">272</span>    // This allocates a buffer that is the size of the message internally.<a name="line.272"></a>
+<span class="sourceLineNo">273</span>    header.writeDelimitedTo(dos);<a name="line.273"></a>
+<span class="sourceLineNo">274</span>    if (param != null) param.writeDelimitedTo(dos);<a name="line.274"></a>
+<span class="sourceLineNo">275</span>    if (cellBlock != null) dos.write(cellBlock.array(), 0, cellBlock.remaining());<a name="line.275"></a>
+<span class="sourceLineNo">276</span>    dos.flush();<a name="line.276"></a>
+<span class="sourceLineNo">277</span>    return totalSize;<a name="line.277"></a>
+<span class="sourceLineNo">278</span>  }<a name="line.278"></a>
+<span class="sourceLineNo">279</span><a name="line.279"></a>
+<span class="sourceLineNo">280</span>  /**<a name="line.280"></a>
+<span class="sourceLineNo">281</span>   * Read in chunks of 8K (HBASE-7239)<a name="line.281"></a>
+<span class="sourceLineNo">282</span>   * @param in<a name="line.282"></a>
+<span class="sourceLineNo">283</span>   * @param dest<a name="line.283"></a>
+<span class="sourceLineNo">284</span>   * @param offset<a name="line.284"></a>
+<span class="sourceLineNo">285</span>   * @param len<a name="line.285"></a>
+<span class="sourceLineNo">286</span>   * @throws IOException<a name="line.286"></a>
+<span class="sourceLineNo">287</span>   */<a name="line.287"></a>
+<span class="sourceLineNo">288</span>  public static void readChunked(final DataInput in, byte[] dest, int offset, int len)<a name="line.288"></a>
+<span class="sourceLineNo">289</span>      throws IOException {<a name="line.289"></a>
+<span class="sourceLineNo">290</span>    int maxRead = 8192;<a name="line.290"></a>
+<span class="sourceLineNo">291</span><a name="line.291"></a>
+<span class="sourceLineNo">292</span>    for (; offset &lt; len; offset += maxRead) {<a name="line.292"></a>
+<span class="sourceLineNo">293</span>      in.readFully(dest, offset, Math.min(len - offset, maxRead));<a name="line.293"></a>
+<span class="sourceLineNo">294</span>    }<a name="line.294"></a>
+<span class="sourceLineNo">295</span>  }<a name="line.295"></a>
+<span class="sourceLineNo">296</span><a name="line.296"></a>
+<span class="sourceLineNo">297</span>  /**<a name="line.297"></a>
+<span class="sourceLineNo">298</span>   * @return Size on the wire when the two messages are written with writeDelimitedTo<a name="line.298"></a>
+<span class="sourceLineNo">299</span>   */<a name="line.299"></a>
+<span class="sourceLineNo">300</span>  public static int getTotalSizeWhenWrittenDelimited(Message ... messages) {<a name="line.300"></a>
+<span class="sourceLineNo">301</span>    int totalSize = 0;<a name="line.301"></a>
+<span class="sourceLineNo">302</span>    for (Message m: messages) {<a name="line.302"></a>
+<span class="sourceLineNo">303</span>      if (m == null) continue;<a name="line.303"></a>
+<span class="sourceLineNo">304</span>      totalSize += m.getSerializedSize();<a name="line.304"></a>
+<span class="sourceLineNo">305</span>      totalSize += CodedOutputStream.computeRawVarint32Size(m.getSerializedSize());<a name="line.305"></a>
+<span class="sourceLineNo">306</span>    }<a name="line.306"></a>
+<span class="sourceLineNo">307</span>    Preconditions.checkArgument(totalSize &lt; Integer.MAX_VALUE);<a name="line.307"></a>
+<span class="sourceLineNo">308</span>    return totalSize;<a name="line.308"></a>
+<span class="sourceLineNo">309</span>  }<a name="line.309"></a>
+<span class="sourceLineNo">310</span>}<a name="line.310"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/a8725a46/devapidocs/src-html/org/apache/hadoop/hbase/ipc/PayloadCarryingRpcController.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/ipc/PayloadCarryingRpcController.html b/devapidocs/src-html/org/apache/hadoop/hbase/ipc/PayloadCarryingRpcController.html
index 6dfcee3..d4aa690 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/ipc/PayloadCarryingRpcController.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/ipc/PayloadCarryingRpcController.html
@@ -43,14 +43,14 @@
 <span class="sourceLineNo">035</span>@InterfaceAudience.Private<a name="line.35"></a>
 <span class="sourceLineNo">036</span>public class PayloadCarryingRpcController<a name="line.36"></a>
 <span class="sourceLineNo">037</span>    extends TimeLimitedRpcController implements CellScannable {<a name="line.37"></a>
-<span class="sourceLineNo">038</span>  /**<a name="line.38"></a>
-<span class="sourceLineNo">039</span>   * Priority to set on this request.  Set it here in controller so available composing the<a name="line.39"></a>
-<span class="sourceLineNo">040</span>   * request.  This is the ordained way of setting priorities going forward.  We will be<a name="line.40"></a>
-<span class="sourceLineNo">041</span>   * undoing the old annotation-based mechanism.<a name="line.41"></a>
-<span class="sourceLineNo">042</span>   */<a name="line.42"></a>
-<span class="sourceLineNo">043</span>  // Currently only multi call makes use of this.  Eventually this should be only way to set<a name="line.43"></a>
-<span class="sourceLineNo">044</span>  // priority.<a name="line.44"></a>
-<span class="sourceLineNo">045</span>  private int priority = HConstants.NORMAL_QOS;<a name="line.45"></a>
+<span class="sourceLineNo">038</span><a name="line.38"></a>
+<span class="sourceLineNo">039</span>  public static final int PRIORITY_UNSET = -1;<a name="line.39"></a>
+<span class="sourceLineNo">040</span>  /**<a name="line.40"></a>
+<span class="sourceLineNo">041</span>   * Priority to set on this request.  Set it here in controller so available composing the<a name="line.41"></a>
+<span class="sourceLineNo">042</span>   * request.  This is the ordained way of setting priorities going forward.  We will be<a name="line.42"></a>
+<span class="sourceLineNo">043</span>   * undoing the old annotation-based mechanism.<a name="line.43"></a>
+<span class="sourceLineNo">044</span>   */<a name="line.44"></a>
+<span class="sourceLineNo">045</span>  private int priority = PRIORITY_UNSET;<a name="line.45"></a>
 <span class="sourceLineNo">046</span><a name="line.46"></a>
 <span class="sourceLineNo">047</span>  /**<a name="line.47"></a>
 <span class="sourceLineNo">048</span>   * They are optionally set on construction, cleared after we make the call, and then optionally<a name="line.48"></a>
@@ -75,43 +75,44 @@
 <span class="sourceLineNo">067</span>  /**<a name="line.67"></a>
 <span class="sourceLineNo">068</span>   * @return One-shot cell scanner (you cannot back it up and restart)<a name="line.68"></a>
 <span class="sourceLineNo">069</span>   */<a name="line.69"></a>
-<span class="sourceLineNo">070</span>  public CellScanner cellScanner() {<a name="line.70"></a>
-<span class="sourceLineNo">071</span>    return cellScanner;<a name="line.71"></a>
-<span class="sourceLineNo">072</span>  }<a name="line.72"></a>
-<span class="sourceLineNo">073</span><a name="line.73"></a>
-<span class="sourceLineNo">074</span>  public void setCellScanner(final CellScanner cellScanner) {<a name="line.74"></a>
-<span class="sourceLineNo">075</span>    this.cellScanner = cellScanner;<a name="line.75"></a>
-<span class="sourceLineNo">076</span>  }<a name="line.76"></a>
-<span class="sourceLineNo">077</span><a name="line.77"></a>
-<span class="sourceLineNo">078</span>  /**<a name="line.78"></a>
-<span class="sourceLineNo">079</span>   * @param priority Priority for this request; should fall roughly in the range<a name="line.79"></a>
-<span class="sourceLineNo">080</span>   * {@link HConstants#NORMAL_QOS} to {@link HConstants#HIGH_QOS}<a name="line.80"></a>
-<span class="sourceLineNo">081</span>   */<a name="line.81"></a>
-<span class="sourceLineNo">082</span>  public void setPriority(int priority) {<a name="line.82"></a>
-<span class="sourceLineNo">083</span>    this.priority = priority;<a name="line.83"></a>
-<span class="sourceLineNo">084</span>  }<a name="line.84"></a>
-<span class="sourceLineNo">085</span><a name="line.85"></a>
-<span class="sourceLineNo">086</span>  /**<a name="line.86"></a>
-<span class="sourceLineNo">087</span>   * @param tn Set priority based off the table we are going against.<a name="line.87"></a>
-<span class="sourceLineNo">088</span>   */<a name="line.88"></a>
-<span class="sourceLineNo">089</span>  public void setPriority(final TableName tn) {<a name="line.89"></a>
-<span class="sourceLineNo">090</span>    this.priority =<a name="line.90"></a>
-<span class="sourceLineNo">091</span>        (tn != null &amp;&amp; tn.isSystemTable())? HConstants.SYSTEMTABLE_QOS: HConstants.NORMAL_QOS;<a name="line.91"></a>
-<span class="sourceLineNo">092</span>  }<a name="line.92"></a>
-<span class="sourceLineNo">093</span><a name="line.93"></a>
-<span class="sourceLineNo">094</span>  /**<a name="line.94"></a>
-<span class="sourceLineNo">095</span>   * @return The priority of this request<a name="line.95"></a>
-<span class="sourceLineNo">096</span>   */<a name="line.96"></a>
-<span class="sourceLineNo">097</span>  public int getPriority() {<a name="line.97"></a>
-<span class="sourceLineNo">098</span>    return priority;<a name="line.98"></a>
-<span class="sourceLineNo">099</span>  }<a name="line.99"></a>
-<span class="sourceLineNo">100</span><a name="line.100"></a>
-<span class="sourceLineNo">101</span>  @Override public void reset() {<a name="line.101"></a>
-<span class="sourceLineNo">102</span>    super.reset();<a name="line.102"></a>
-<span class="sourceLineNo">103</span>    priority = 0;<a name="line.103"></a>
-<span class="sourceLineNo">104</span>    cellScanner = null;<a name="line.104"></a>
-<span class="sourceLineNo">105</span>  }<a name="line.105"></a>
-<span class="sourceLineNo">106</span>}<a name="line.106"></a>
+<span class="sourceLineNo">070</span>  @Override<a name="line.70"></a>
+<span class="sourceLineNo">071</span>  public CellScanner cellScanner() {<a name="line.71"></a>
+<span class="sourceLineNo">072</span>    return cellScanner;<a name="line.72"></a>
+<span class="sourceLineNo">073</span>  }<a name="line.73"></a>
+<span class="sourceLineNo">074</span><a name="line.74"></a>
+<span class="sourceLineNo">075</span>  public void setCellScanner(final CellScanner cellScanner) {<a name="line.75"></a>
+<span class="sourceLineNo">076</span>    this.cellScanner = cellScanner;<a name="line.76"></a>
+<span class="sourceLineNo">077</span>  }<a name="line.77"></a>
+<span class="sourceLineNo">078</span><a name="line.78"></a>
+<span class="sourceLineNo">079</span>  /**<a name="line.79"></a>
+<span class="sourceLineNo">080</span>   * @param priority Priority for this request; should fall roughly in the range<a name="line.80"></a>
+<span class="sourceLineNo">081</span>   * {@link HConstants#NORMAL_QOS} to {@link HConstants#HIGH_QOS}<a name="line.81"></a>
+<span class="sourceLineNo">082</span>   */<a name="line.82"></a>
+<span class="sourceLineNo">083</span>  public void setPriority(int priority) {<a name="line.83"></a>
+<span class="sourceLineNo">084</span>    this.priority = priority;<a name="line.84"></a>
+<span class="sourceLineNo">085</span>  }<a name="line.85"></a>
+<span class="sourceLineNo">086</span><a name="line.86"></a>
+<span class="sourceLineNo">087</span>  /**<a name="line.87"></a>
+<span class="sourceLineNo">088</span>   * @param tn Set priority based off the table we are going against.<a name="line.88"></a>
+<span class="sourceLineNo">089</span>   */<a name="line.89"></a>
+<span class="sourceLineNo">090</span>  public void setPriority(final TableName tn) {<a name="line.90"></a>
+<span class="sourceLineNo">091</span>    this.priority =<a name="line.91"></a>
+<span class="sourceLineNo">092</span>        (tn != null &amp;&amp; tn.isSystemTable())? HConstants.SYSTEMTABLE_QOS: HConstants.NORMAL_QOS;<a name="line.92"></a>
+<span class="sourceLineNo">093</span>  }<a name="line.93"></a>
+<span class="sourceLineNo">094</span><a name="line.94"></a>
+<span class="sourceLineNo">095</span>  /**<a name="line.95"></a>
+<span class="sourceLineNo">096</span>   * @return The priority of this request<a name="line.96"></a>
+<span class="sourceLineNo">097</span>   */<a name="line.97"></a>
+<span class="sourceLineNo">098</span>  public int getPriority() {<a name="line.98"></a>
+<span class="sourceLineNo">099</span>    return priority;<a name="line.99"></a>
+<span class="sourceLineNo">100</span>  }<a name="line.100"></a>
+<span class="sourceLineNo">101</span><a name="line.101"></a>
+<span class="sourceLineNo">102</span>  @Override public void reset() {<a name="line.102"></a>
+<span class="sourceLineNo">103</span>    super.reset();<a name="line.103"></a>
+<span class="sourceLineNo">104</span>    priority = 0;<a name="line.104"></a>
+<span class="sourceLineNo">105</span>    cellScanner = null;<a name="line.105"></a>
+<span class="sourceLineNo">106</span>  }<a name="line.106"></a>
+<span class="sourceLineNo">107</span>}<a name="line.107"></a>
 
 
 


Mime
View raw message