Java 类org.apache.hadoop.hbase.ipc.RegionCoprocessorRpcChannel 实例源码

项目:ditb    文件:HTable.java   
/**
 * {@inheritDoc}
 */
@Override
public CoprocessorRpcChannel coprocessorService(byte[] row) {
  return new RegionCoprocessorRpcChannel(connection, tableName, row);
}
项目:ditb    文件:HTable.java   
/**
 * {@inheritDoc}
 */
@Override
public <T extends Service, R> void coprocessorService(final Class<T> service,
    byte[] startKey, byte[] endKey, final Batch.Call<T,R> callable,
    final Batch.Callback<R> callback) throws ServiceException, Throwable {

  // get regions covered by the row range
  List<byte[]> keys = getStartKeysInRange(startKey, endKey);

  Map<byte[],Future<R>> futures =
      new TreeMap<byte[],Future<R>>(Bytes.BYTES_COMPARATOR);
  for (final byte[] r : keys) {
    final RegionCoprocessorRpcChannel channel =
        new RegionCoprocessorRpcChannel(connection, tableName, r);
    Future<R> future = pool.submit(
        new Callable<R>() {
          @Override
          public R call() throws Exception {
            T instance = ProtobufUtil.newServiceStub(service, channel);
            R result = callable.call(instance);
            byte[] region = channel.getLastRegion();
            if (callback != null) {
              callback.update(region, r, result);
            }
            return result;
          }
        });
    futures.put(r, future);
  }
  for (Map.Entry<byte[],Future<R>> e : futures.entrySet()) {
    try {
      e.getValue().get();
    } catch (ExecutionException ee) {
      LOG.warn("Error calling coprocessor service " + service.getName() + " for row "
          + Bytes.toStringBinary(e.getKey()), ee);
      throw ee.getCause();
    } catch (InterruptedException ie) {
      throw new InterruptedIOException("Interrupted calling coprocessor service " + service.getName()
          + " for row " + Bytes.toStringBinary(e.getKey()))
          .initCause(ie);
    }
  }
}
项目:pbase    文件:HTable.java   
/**
 * {@inheritDoc}
 */
@Override
public CoprocessorRpcChannel coprocessorService(byte[] row) {
  return new RegionCoprocessorRpcChannel(connection, tableName, row);
}
项目:pbase    文件:HTable.java   
/**
 * {@inheritDoc}
 */
@Override
public <T extends Service, R> void coprocessorService(final Class<T> service,
    byte[] startKey, byte[] endKey, final Batch.Call<T,R> callable,
    final Batch.Callback<R> callback) throws ServiceException, Throwable {

  // get regions covered by the row range
  List<byte[]> keys = getStartKeysInRange(startKey, endKey);

  Map<byte[],Future<R>> futures =
      new TreeMap<byte[],Future<R>>(Bytes.BYTES_COMPARATOR);
  for (final byte[] r : keys) {
    final RegionCoprocessorRpcChannel channel =
        new RegionCoprocessorRpcChannel(connection, tableName, r);
    Future<R> future = pool.submit(
        new Callable<R>() {
          @Override
          public R call() throws Exception {
            T instance = ProtobufUtil.newServiceStub(service, channel);
            R result = callable.call(instance);
            byte[] region = channel.getLastRegion();
            if (callback != null) {
              callback.update(region, r, result);
            }
            return result;
          }
        });
    futures.put(r, future);
  }
  for (Map.Entry<byte[],Future<R>> e : futures.entrySet()) {
    try {
      e.getValue().get();
    } catch (ExecutionException ee) {
      LOG.warn("Error calling coprocessor service " + service.getName() + " for row "
          + Bytes.toStringBinary(e.getKey()), ee);
      throw ee.getCause();
    } catch (InterruptedException ie) {
      throw new InterruptedIOException("Interrupted calling coprocessor service " + service.getName()
          + " for row " + Bytes.toStringBinary(e.getKey()))
          .initCause(ie);
    }
  }
}
项目:HIndex    文件:HTable.java   
/**
 * {@inheritDoc}
 */
public CoprocessorRpcChannel coprocessorService(byte[] row) {
  return new RegionCoprocessorRpcChannel(connection, tableName, row, rpcCallerFactory,
      rpcControllerFactory);
}
项目:HIndex    文件:HTable.java   
/**
 * {@inheritDoc}
 */
@Override
public <T extends Service, R> void coprocessorService(final Class<T> service,
    byte[] startKey, byte[] endKey, final Batch.Call<T,R> callable,
    final Batch.Callback<R> callback) throws ServiceException, Throwable {

  // get regions covered by the row range
  List<byte[]> keys = getStartKeysInRange(startKey, endKey);

  Map<byte[],Future<R>> futures =
      new TreeMap<byte[],Future<R>>(Bytes.BYTES_COMPARATOR);
  for (final byte[] r : keys) {
    final RegionCoprocessorRpcChannel channel =
        new RegionCoprocessorRpcChannel(connection, tableName, r, rpcCallerFactory,
            rpcControllerFactory);
    Future<R> future = pool.submit(
        new Callable<R>() {
          public R call() throws Exception {
            T instance = ProtobufUtil.newServiceStub(service, channel);
            R result = callable.call(instance);
            byte[] region = channel.getLastRegion();
            if (callback != null) {
              callback.update(region, r, result);
            }
            return result;
          }
        });
    futures.put(r, future);
  }
  for (Map.Entry<byte[],Future<R>> e : futures.entrySet()) {
    try {
      e.getValue().get();
    } catch (ExecutionException ee) {
      LOG.warn("Error calling coprocessor service " + service.getName() + " for row "
          + Bytes.toStringBinary(e.getKey()), ee);
      throw ee.getCause();
    } catch (InterruptedException ie) {
      throw new InterruptedIOException("Interrupted calling coprocessor service " + service.getName()
          + " for row " + Bytes.toStringBinary(e.getKey()))
          .initCause(ie);
    }
  }
}
项目:PyroDB    文件:HTable.java   
/**
 * {@inheritDoc}
 */
public CoprocessorRpcChannel coprocessorService(byte[] row) {
  return new RegionCoprocessorRpcChannel(connection, tableName, row);
}
项目:PyroDB    文件:HTable.java   
/**
 * {@inheritDoc}
 */
@Override
public <T extends Service, R> void coprocessorService(final Class<T> service,
    byte[] startKey, byte[] endKey, final Batch.Call<T,R> callable,
    final Batch.Callback<R> callback) throws ServiceException, Throwable {

  // get regions covered by the row range
  List<byte[]> keys = getStartKeysInRange(startKey, endKey);

  Map<byte[],Future<R>> futures =
      new TreeMap<byte[],Future<R>>(Bytes.BYTES_COMPARATOR);
  for (final byte[] r : keys) {
    final RegionCoprocessorRpcChannel channel =
        new RegionCoprocessorRpcChannel(connection, tableName, r);
    Future<R> future = pool.submit(
        new Callable<R>() {
          public R call() throws Exception {
            T instance = ProtobufUtil.newServiceStub(service, channel);
            R result = callable.call(instance);
            byte[] region = channel.getLastRegion();
            if (callback != null) {
              callback.update(region, r, result);
            }
            return result;
          }
        });
    futures.put(r, future);
  }
  for (Map.Entry<byte[],Future<R>> e : futures.entrySet()) {
    try {
      e.getValue().get();
    } catch (ExecutionException ee) {
      LOG.warn("Error calling coprocessor service " + service.getName() + " for row "
          + Bytes.toStringBinary(e.getKey()), ee);
      throw ee.getCause();
    } catch (InterruptedException ie) {
      throw new InterruptedIOException("Interrupted calling coprocessor service " + service.getName()
          + " for row " + Bytes.toStringBinary(e.getKey()))
          .initCause(ie);
    }
  }
}
项目:c5    文件:HTable.java   
/**
 * {@inheritDoc}
 */
public CoprocessorRpcChannel coprocessorService(byte[] row) {
  return new RegionCoprocessorRpcChannel(connection, tableName, row);
}
项目:c5    文件:HTable.java   
/**
 * {@inheritDoc}
 */
@Override
public <T extends Service, R> void coprocessorService(final Class<T> service,
    byte[] startKey, byte[] endKey, final Batch.Call<T,R> callable,
    final Batch.Callback<R> callback) throws ServiceException, Throwable {

  // get regions covered by the row range
  List<byte[]> keys = getStartKeysInRange(startKey, endKey);

  Map<byte[],Future<R>> futures =
      new TreeMap<byte[],Future<R>>(Bytes.BYTES_COMPARATOR);
  for (final byte[] r : keys) {
    final RegionCoprocessorRpcChannel channel =
        new RegionCoprocessorRpcChannel(connection, tableName, r);
    Future<R> future = pool.submit(
        new Callable<R>() {
          public R call() throws Exception {
            T instance = ProtobufUtil.newServiceStub(service, channel);
            R result = callable.call(instance);
            byte[] region = channel.getLastRegion();
            if (callback != null) {
              callback.update(region, r, result);
            }
            return result;
          }
        });
    futures.put(r, future);
  }
  for (Map.Entry<byte[],Future<R>> e : futures.entrySet()) {
    try {
      e.getValue().get();
    } catch (ExecutionException ee) {
      LOG.warn("Error calling coprocessor service " + service.getName() + " for row "
          + Bytes.toStringBinary(e.getKey()), ee);
      throw ee.getCause();
    } catch (InterruptedException ie) {
      Thread.currentThread().interrupt();
      throw new InterruptedIOException("Interrupted calling coprocessor service " + service.getName()
          + " for row " + Bytes.toStringBinary(e.getKey()))
          .initCause(ie);
    }
  }
}
项目:DominoHBase    文件:HTable.java   
/**
 * {@inheritDoc}
 */
public CoprocessorRpcChannel coprocessorService(byte[] row) {
  return new RegionCoprocessorRpcChannel(connection, tableName, row);
}
项目:DominoHBase    文件:HTable.java   
/**
 * {@inheritDoc}
 */
@Override
public <T extends Service, R> void coprocessorService(final Class<T> service,
    byte[] startKey, byte[] endKey, final Batch.Call<T,R> callable,
    final Batch.Callback<R> callback) throws ServiceException, Throwable {

  // get regions covered by the row range
  List<byte[]> keys = getStartKeysInRange(startKey, endKey);

  Map<byte[],Future<R>> futures =
      new TreeMap<byte[],Future<R>>(Bytes.BYTES_COMPARATOR);
  for (final byte[] r : keys) {
    final RegionCoprocessorRpcChannel channel =
        new RegionCoprocessorRpcChannel(connection, tableName, r);
    Future<R> future = pool.submit(
        new Callable<R>() {
          public R call() throws Exception {
            T instance = ProtobufUtil.newServiceStub(service, channel);
            R result = callable.call(instance);
            byte[] region = channel.getLastRegion();
            if (callback != null) {
              callback.update(region, r, result);
            }
            return result;
          }
        });
    futures.put(r, future);
  }
  for (Map.Entry<byte[],Future<R>> e : futures.entrySet()) {
    try {
      e.getValue().get();
    } catch (ExecutionException ee) {
      LOG.warn("Error calling coprocessor service " + service.getName() + " for row "
          + Bytes.toStringBinary(e.getKey()), ee);
      throw ee.getCause();
    } catch (InterruptedException ie) {
      Thread.currentThread().interrupt();
      throw new InterruptedIOException("Interrupted calling coprocessor service " + service.getName()
          + " for row " + Bytes.toStringBinary(e.getKey()))
          .initCause(ie);
    }
  }
}
项目:spliceengine    文件:Hbase10RpcChannelFactory.java   
@Override
public CoprocessorRpcChannel newChannel(TableName tableName,byte[] regionKey) throws IOException{
    Connection conn=HBaseConnectionFactory.getInstance(config).getNoRetryConnection();
    return new RegionCoprocessorRpcChannel((HConnection)conn,tableName,regionKey);
}
项目:spliceengine    文件:Hbase10RpcChannelFactory.java   
@Override
public CoprocessorRpcChannel newChannel(TableName tableName,byte[] regionKey) throws IOException{
    Connection conn=HBaseConnectionFactory.getInstance(config).getNoRetryConnection();
    return new RegionCoprocessorRpcChannel((ClusterConnection)conn,tableName,regionKey);
}
项目:spliceengine    文件:Hbase10RpcChannelFactory.java   
@Override
public CoprocessorRpcChannel newChannel(TableName tableName,byte[] regionKey) throws IOException{
    Connection conn=HBaseConnectionFactory.getInstance(config).getNoRetryConnection();
    return new RegionCoprocessorRpcChannel((HConnection) conn,tableName,regionKey);
}
项目:spliceengine    文件:Hbase10RpcChannelFactory.java   
@Override
public CoprocessorRpcChannel newChannel(TableName tableName,byte[] regionKey) throws IOException{
    Connection conn=HBaseConnectionFactory.getInstance(config).getNoRetryConnection();
    return new RegionCoprocessorRpcChannel((ClusterConnection)conn,tableName,regionKey);
}
项目:spliceengine    文件:Hbase10RpcChannelFactory.java   
@Override
public CoprocessorRpcChannel newChannel(TableName tableName,byte[] regionKey) throws IOException{
    Connection conn=HBaseConnectionFactory.getInstance(config).getNoRetryConnection();
    return new RegionCoprocessorRpcChannel((HConnection) conn,tableName,regionKey);
}
项目:spliceengine    文件:Hbase10RpcChannelFactory.java   
@Override
public CoprocessorRpcChannel newChannel(TableName tableName,byte[] regionKey) throws IOException{
    Connection conn=HBaseConnectionFactory.getInstance(config).getNoRetryConnection();
    return new RegionCoprocessorRpcChannel((HConnection)conn,tableName,regionKey);
}
项目:spliceengine    文件:Hbase10RpcChannelFactory.java   
@Override
public CoprocessorRpcChannel newChannel(TableName tableName,byte[] regionKey) throws IOException{
    Connection conn=HBaseConnectionFactory.getInstance(config).getNoRetryConnection();
    return new RegionCoprocessorRpcChannel((ClusterConnection) conn,tableName,regionKey);
}