You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by karthik tunga <ka...@gmail.com> on 2011/07/20 20:04:18 UTC

HConnectionManager doubt

Hi,

I was going through the hbase code (HConnectionManager class)

 public void processBatch(List<Row> list,
        final byte[] tableName,
        ExecutorService pool,
        Object[] results) throws IOException, InterruptedException {

      // results must be the same size as list
      if (results.length != list.size()) {
        throw new IllegalArgumentException("argument results must be
the same size as argument list");
      }

      processBatchCallback(list, tableName, pool, results, null);
    }

and in  processBatchCallback we are checking the list sizes again

public <R> void processBatchCallback(
        List<? extends Row> list,
        byte[] tableName,
        ExecutorService pool,
        Object[] results,
        Batch.Callback<R> callback)
    throws IOException, InterruptedException {

      // results must be the same size as list
      if (results.length != list.size()) {
        throw new IllegalArgumentException(
            "argument results must be the same size as argument list");
      }


I did not find any other calls for the method processBatchCallback.
Isn't this a redundant check ? or is there any specific reason for the
check being made again ?


Cheers,
Karthik

Re: HConnectionManager doubt

Posted by Jean-Daniel Cryans <jd...@apache.org>.
It does seem redundant, feel free to open a jira.

J-D

On Wed, Jul 20, 2011 at 11:04 AM, karthik tunga <ka...@gmail.com> wrote:
> Hi,
>
> I was going through the hbase code (HConnectionManager class)
>
>  public void processBatch(List<Row> list,
>        final byte[] tableName,
>        ExecutorService pool,
>        Object[] results) throws IOException, InterruptedException {
>
>      // results must be the same size as list
>      if (results.length != list.size()) {
>        throw new IllegalArgumentException("argument results must be
> the same size as argument list");
>      }
>
>      processBatchCallback(list, tableName, pool, results, null);
>    }
>
> and in  processBatchCallback we are checking the list sizes again
>
> public <R> void processBatchCallback(
>        List<? extends Row> list,
>        byte[] tableName,
>        ExecutorService pool,
>        Object[] results,
>        Batch.Callback<R> callback)
>    throws IOException, InterruptedException {
>
>      // results must be the same size as list
>      if (results.length != list.size()) {
>        throw new IllegalArgumentException(
>            "argument results must be the same size as argument list");
>      }
>
>
> I did not find any other calls for the method processBatchCallback.
> Isn't this a redundant check ? or is there any specific reason for the
> check being made again ?
>
>
> Cheers,
> Karthik
>