当前位置: 首页>>代码示例>>Java>>正文


Java Exec类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.client.coprocessor.Exec的典型用法代码示例。如果您正苦于以下问题:Java Exec类的具体用法?Java Exec怎么用?Java Exec使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Exec类属于org.apache.hadoop.hbase.client.coprocessor包,在下文中一共展示了Exec类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: invoke

import org.apache.hadoop.hbase.client.coprocessor.Exec; //导入依赖的package包/类
@Override
public Object invoke(Object instance, final Method method, final Object[] args)
    throws Throwable {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Call: "+method.getName()+", "+(args != null ? args.length : 0));
  }

  if (row != null) {
    final Exec exec = new Exec(conf, row, protocol, method, args);
    ServerCallable<ExecResult> callable =
        new ServerCallable<ExecResult>(connection, table, row) {
          public ExecResult call() throws Exception {
            return server.execCoprocessor(location.getRegionInfo().getRegionName(),
                exec);
          }
        };
    ExecResult result = callable.withRetries();
    this.regionName = result.getRegionName();
    LOG.debug("Result is region="+ Bytes.toStringBinary(regionName) +
        ", value="+result.getValue());
    return result.getValue();
  }

  return null;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:26,代码来源:ExecRPCInvoker.java

示例2: testExecDeserialization

import org.apache.hadoop.hbase.client.coprocessor.Exec; //导入依赖的package包/类
@Test
public void testExecDeserialization() throws IOException {
  DataOutputBuffer dob = new DataOutputBuffer();
  dob.writeUTF(methodName);
  dob.writeInt(1);
  Scan scan = new Scan();
  HbaseObjectWritable.writeObject(dob, scan, Scan.class, new Configuration());
  dob.writeUTF("org.apache.hadoop.hbase.client.Scan");
  Bytes.writeByteArray(dob, new byte[]{'a'});
  // this is the dynamic protocol name
  dob.writeUTF(protocolName);

  DataInputBuffer dib = new DataInputBuffer();
  dib.reset(dob.getData(), dob.getLength());

  Exec after = new Exec();
  after.setConf(HBaseConfiguration.create());
  after.readFields(dib);
  // no error thrown
  assertEquals(after.getProtocolName(), protocolName);
  assertEquals(after.getMethodName(), methodName);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:23,代码来源:TestCoprocessorEndpoint.java

示例3: invoke

import org.apache.hadoop.hbase.client.coprocessor.Exec; //导入依赖的package包/类
@Override
public Object invoke(Object instance, final Method method, final Object[] args)
    throws Throwable {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Call: "+method.getName()+", "+(args != null ? args.length : 0));
  }

  if (row != null) {
    final Exec exec = new Exec(conf, row, protocol, method, args);
    ServerCallable<ExecResult> callable =
        new ServerCallable<ExecResult>(connection, table, row) {
          public ExecResult call() throws Exception {
            return server.execCoprocessor(location.getRegionInfo().getRegionName(),
                exec);
          }
        };
    ExecResult result = connection.getRegionServerWithRetries(callable);
    this.regionName = result.getRegionName();
    LOG.debug("Result is region="+ Bytes.toStringBinary(regionName) +
        ", value="+result.getValue());
    return result.getValue();
  }

  return null;
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:26,代码来源:ExecRPCInvoker.java

示例4: invoke

import org.apache.hadoop.hbase.client.coprocessor.Exec; //导入依赖的package包/类
@Override
public Object invoke(Object instance, final Method method, final Object[] args)
    throws Throwable {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Call: "+method.getName()+", "+(args != null ? args.length : 0));
  }
  Exec exec = new Exec(conf, protocol, method, args);
  ExecResult result = connection.getMaster().execCoprocessor(exec);
  LOG.debug("Master Result is value="+result.getValue());
  return result.getValue();
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:12,代码来源:MasterExecRPCInvoker.java

示例5: execCoprocessor

import org.apache.hadoop.hbase.client.coprocessor.Exec; //导入依赖的package包/类
/**
 * Executes a single {@link org.apache.hadoop.hbase.ipc.CoprocessorProtocol} method using the
 * registered protocol handlers. {@link CoprocessorProtocol} implementations must be registered
 * per-region via the
 * {@link org.apache.hadoop.hbase.regionserver.HRegion#registerProtocol(Class, org.apache.hadoop.hbase.ipc.CoprocessorProtocol)}
 * method before they are available.
 * @param regionName name of the region against which the invocation is executed
 * @param call an {@code Exec} instance identifying the protocol, method name, and parameters for
 *          the method invocation
 * @return an {@code ExecResult} instance containing the region name of the invocation and the
 *         return value
 * @throws IOException if no registered protocol handler is found or an error occurs during the
 *           invocation
 * @see org.apache.hadoop.hbase.regionserver.HRegion#registerProtocol(Class,
 *      org.apache.hadoop.hbase.ipc.CoprocessorProtocol)
 */
@Override
public ExecResult execCoprocessor(byte[] regionName, Exec call) throws IOException {
  checkOpen();
  requestCount.incrementAndGet();
  try {
    HRegion region = getRegion(regionName);
    return region.exec(call);
  } catch (Throwable t) {
    throw convertThrowableToIOE(cleanup(t));
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:28,代码来源:HRegionServer.java

示例6: execCoprocessor

import org.apache.hadoop.hbase.client.coprocessor.Exec; //导入依赖的package包/类
/**
 * Executes a single {@link org.apache.hadoop.hbase.ipc.CoprocessorProtocol}
 * method using the registered protocol handlers.
 * {@link CoprocessorProtocol} implementations must be registered per-region
 * via the
 * {@link org.apache.hadoop.hbase.regionserver.HRegion#registerProtocol(Class, org.apache.hadoop.hbase.ipc.CoprocessorProtocol)}
 * method before they are available.
 *
 * @param regionName name of the region against which the invocation is executed
 * @param call an {@code Exec} instance identifying the protocol, method name,
 *     and parameters for the method invocation
 * @return an {@code ExecResult} instance containing the region name of the
 *     invocation and the return value
 * @throws IOException if no registered protocol handler is found or an error
 *     occurs during the invocation
 * @see org.apache.hadoop.hbase.regionserver.HRegion#registerProtocol(Class, org.apache.hadoop.hbase.ipc.CoprocessorProtocol)
 */
@Override
public ExecResult execCoprocessor(byte[] regionName, Exec call)
    throws IOException {
  checkOpen();
  requestCount.incrementAndGet();
  try {
    HRegion region = getRegion(regionName);
    return region.exec(call);
  } catch (Throwable t) {
    throw convertThrowableToIOE(cleanup(t));
  }
}
 
开发者ID:wanhao,项目名称:IRIndex,代码行数:30,代码来源:HRegionServer.java

示例7: execCoprocessor

import org.apache.hadoop.hbase.client.coprocessor.Exec; //导入依赖的package包/类
/**
 * Executes a single {@link org.apache.hadoop.hbase.ipc.CoprocessorProtocol}
 * method using the registered protocol handlers.
 * {@link CoprocessorProtocol} implementations must be registered via the
 * {@link org.apache.hadoop.hbase.master.MasterServices#registerProtocol(Class, CoprocessorProtocol)}
 * method before they are available.
 *
 * @param call an {@code Exec} instance identifying the protocol, method name,
 *     and parameters for the method invocation
 * @return an {@code ExecResult} instance containing the region name of the
 *     invocation and the return value
 * @throws IOException if no registered protocol handler is found or an error
 *     occurs during the invocation
 * @see org.apache.hadoop.hbase.master.MasterServices#registerProtocol(Class, CoprocessorProtocol)
 */
public ExecResult execCoprocessor(Exec call)
    throws IOException;
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:18,代码来源:HMasterInterface.java

示例8: execCoprocessor

import org.apache.hadoop.hbase.client.coprocessor.Exec; //导入依赖的package包/类
/**
 * Executes a single {@link org.apache.hadoop.hbase.ipc.CoprocessorProtocol}
 * method using the registered protocol handlers.
 * {@link CoprocessorProtocol} implementations must be registered via the
 * {@link org.apache.hadoop.hbase.regionserver.HRegion#registerProtocol(Class, org.apache.hadoop.hbase.ipc.CoprocessorProtocol)}
 * method before they are available.
 *
 * @param regionName name of the region against which the invocation is executed
 * @param call an {@code Exec} instance identifying the protocol, method name,
 *     and parameters for the method invocation
 * @return an {@code ExecResult} instance containing the region name of the
 *     invocation and the return value
 * @throws IOException if no registered protocol handler is found or an error
 *     occurs during the invocation
 * @see org.apache.hadoop.hbase.regionserver.HRegion#registerProtocol(Class, org.apache.hadoop.hbase.ipc.CoprocessorProtocol)
 */
ExecResult execCoprocessor(byte[] regionName, Exec call)
    throws IOException;
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:19,代码来源:HRegionInterface.java


注:本文中的org.apache.hadoop.hbase.client.coprocessor.Exec类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。