本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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();
}
示例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));
}
}
示例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));
}
}
示例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;
示例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;