本文整理汇总了Java中org.apache.hadoop.hbase.ipc.CoprocessorProtocol类的典型用法代码示例。如果您正苦于以下问题:Java CoprocessorProtocol类的具体用法?Java CoprocessorProtocol怎么用?Java CoprocessorProtocol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CoprocessorProtocol类属于org.apache.hadoop.hbase.ipc包,在下文中一共展示了CoprocessorProtocol类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: registerProtocol
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
@Override
public <T extends CoprocessorProtocol> boolean registerProtocol(
Class<T> protocol, T handler) {
/* No stacking of protocol handlers is currently allowed. The
* first to claim wins!
*/
if (protocolHandlers.containsKey(protocol)) {
LOG.error("Protocol "+protocol.getName()+
" already registered, rejecting request from "+
handler
);
return false;
}
protocolHandlers.putInstance(protocol, handler);
protocolHandlerNames.put(protocol.getName(), protocol);
if (LOG.isDebugEnabled()) {
LOG.debug("Registered master protocol handler: protocol="+protocol.getName());
}
return true;
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:23,代码来源:HMaster.java
示例2: registerProtocol
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
/**
* Registers a new CoprocessorProtocol subclass and instance to be available for handling
* {@link HRegion#exec(Exec)} calls.
* <p>
* Only a single protocol type/handler combination may be registered per region. After the first
* registration, subsequent calls with the same protocol type will fail with a return value of
* {@code false}.
* </p>
* @param protocol a {@code CoprocessorProtocol} subinterface defining the protocol methods
* @param handler an instance implementing the interface
* @param <T> the protocol type
* @return {@code true} if the registration was successful, {@code false} otherwise
*/
public <T extends CoprocessorProtocol> boolean registerProtocol(Class<T> protocol, T handler) {
/*
* No stacking of protocol handlers is currently allowed. The first to claim wins!
*/
if (protocolHandlers.containsKey(protocol)) {
LOG.error("Protocol " + protocol.getName() + " already registered, rejecting request from "
+ handler);
return false;
}
protocolHandlers.putInstance(protocol, handler);
protocolHandlerNames.put(protocol.getName(), protocol);
if (LOG.isDebugEnabled()) {
LOG.debug("Registered protocol handler: region=" + Bytes.toStringBinary(getRegionName())
+ " protocol=" + protocol.getName());
}
return true;
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:33,代码来源:HRegion.java
示例3: coprocessorExec
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public <T extends CoprocessorProtocol, R> Map<byte[],R> coprocessorExec(
Class<T> protocol, byte[] startKey, byte[] endKey,
Batch.Call<T,R> callable)
throws IOException, Throwable {
final Map<byte[],R> results = Collections.synchronizedMap(new TreeMap<byte[],R>(
Bytes.BYTES_COMPARATOR));
coprocessorExec(protocol, startKey, endKey, callable,
new Batch.Callback<R>(){
public void update(byte[] region, byte[] row, R value) {
results.put(region, value);
}
});
return results;
}
开发者ID:wanhao,项目名称:IRIndex,代码行数:20,代码来源:HTable.java
示例4: registerProtocol
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
/**
* Registers a new CoprocessorProtocol subclass and instance to
* be available for handling {@link HRegion#exec(Exec)} calls.
*
* <p>
* Only a single protocol type/handler combination may be registered per
* region.
* After the first registration, subsequent calls with the same protocol type
* will fail with a return value of {@code false}.
* </p>
* @param protocol a {@code CoprocessorProtocol} subinterface defining the
* protocol methods
* @param handler an instance implementing the interface
* @param <T> the protocol type
* @return {@code true} if the registration was successful, {@code false}
* otherwise
*/
public <T extends CoprocessorProtocol> boolean registerProtocol(
Class<T> protocol, T handler) {
/* No stacking of protocol handlers is currently allowed. The
* first to claim wins!
*/
if (protocolHandlers.containsKey(protocol)) {
LOG.error("Protocol "+protocol.getName()+
" already registered, rejecting request from "+
handler
);
return false;
}
protocolHandlers.putInstance(protocol, handler);
protocolHandlerNames.put(protocol.getName(), protocol);
if (LOG.isDebugEnabled()) {
LOG.debug("Registered protocol handler: region="+
Bytes.toStringBinary(getRegionName())+" protocol="+protocol.getName());
}
return true;
}
开发者ID:wanhao,项目名称:IRIndex,代码行数:40,代码来源:HRegion.java
示例5: coprocessorExec
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public <T extends CoprocessorProtocol, R> Map<byte[],R> coprocessorExec(
Class<T> protocol, byte[] startKey, byte[] endKey,
Batch.Call<T,R> callable)
throws IOException, Throwable {
final Map<byte[],R> results = new TreeMap<byte[],R>(
Bytes.BYTES_COMPARATOR);
coprocessorExec(protocol, startKey, endKey, callable,
new Batch.Callback<R>(){
public void update(byte[] region, byte[] row, R value) {
results.put(region, value);
}
});
return results;
}
开发者ID:lifeng5042,项目名称:RStore,代码行数:20,代码来源:HTable.java
示例6: createEnvironment
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
@Override
public RegionEnvironment createEnvironment(Class<?> implClass,
Coprocessor instance, int priority, int seq, Configuration conf) {
// Check if it's an Endpoint.
// Due to current dynamic protocol design, Endpoint
// uses a different way to be registered and executed.
// It uses a visitor pattern to invoke registered Endpoint
// method.
for (Class c : implClass.getInterfaces()) {
if (CoprocessorProtocol.class.isAssignableFrom(c)) {
region.registerProtocol(c, (CoprocessorProtocol)instance);
break;
}
}
return new RegionEnvironment(instance, priority, seq, conf, region,
rsServices);
}
开发者ID:lifeng5042,项目名称:RStore,代码行数:18,代码来源:RegionCoprocessorHost.java
示例7: coprocessorExec
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public <T extends CoprocessorProtocol, R> Map<byte[], R> coprocessorExec(Class<T> protocol,
byte[] startKey, byte[] endKey, Batch.Call<T, R> callable) throws IOException, Throwable {
final Map<byte[], R> results =
Collections.synchronizedMap(new TreeMap<byte[], R>(Bytes.BYTES_COMPARATOR));
coprocessorExec(protocol, startKey, endKey, callable, new Batch.Callback<R>() {
public void update(byte[] region, byte[] row, R value) {
results.put(region, value);
}
});
return results;
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:17,代码来源:HTable.java
示例8: coprocessorExec
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
@Override
public <T extends CoprocessorProtocol, R> void coprocessorExec(
Class<T> protocol, byte[] startKey, byte[] endKey,
Batch.Call<T, R> callable, Batch.Callback<R> callback)
throws IOException, Throwable {
table.coprocessorExec(protocol, startKey, endKey, callable, callback);
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:8,代码来源:HTablePool.java
示例9: forMethod
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
/**
* Creates a new {@link Batch.Call} instance that invokes a method
* with the given parameters and returns the result.
*
* @param method the method reference to invoke
* @param args zero or more arguments to be passed to the method
* @param <T> the class type of the protocol implementation being invoked
* @param <R> the return type for the method call
* @return a {@code Callable} instance that will invoke the given method and
* return the results
* @see org.apache.hadoop.hbase.client.HTable#coprocessorExec(Class, byte[], byte[], org.apache.hadoop.hbase.client.coprocessor.Batch.Call, org.apache.hadoop.hbase.client.coprocessor.Batch.Callback)
*/
public static <T extends CoprocessorProtocol,R> Call<T,R> forMethod(
final Method method, final Object... args) {
return new Call<T,R>() {
public R call(T instance) throws IOException {
try {
if (Proxy.isProxyClass(instance.getClass())) {
InvocationHandler invoker = Proxy.getInvocationHandler(instance);
return (R)invoker.invoke(instance, method, args);
} else {
LOG.warn("Non proxied invocation of method '"+method.getName()+"'!");
return (R)method.invoke(instance, args);
}
}
catch (IllegalAccessException iae) {
throw new IOException("Unable to invoke method '"+
method.getName()+"'", iae);
}
catch (InvocationTargetException ite) {
throw new IOException(ite.toString(), ite);
}
catch (Throwable t) {
throw new IOException(t.toString(), t);
}
}
};
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:39,代码来源:Batch.java
示例10: Exec
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
public Exec(Configuration configuration,
byte[] row,
Class<? extends CoprocessorProtocol> protocol,
Method method, Object[] parameters) {
super(method, protocol, parameters);
this.conf = configuration;
this.referenceRow = row;
this.protocol = protocol;
this.protocolName = protocol.getName();
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:11,代码来源:Exec.java
示例11: coprocessorExec
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
@Override
public <T extends CoprocessorProtocol, R> Map<byte[], R> coprocessorExec(
Class<T> protocol, byte[] startKey, byte[] endKey,
Batch.Call<T, R> callable)
throws IOException, Throwable {
throw new UnsupportedOperationException("coprocessorExec not implemented");
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:8,代码来源:RemoteHTable.java
示例12: createEnvironment
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
@Override
public MasterEnvironment createEnvironment(final Class<?> implClass,
final Coprocessor instance, final int priority, final int seq,
final Configuration conf) {
for (Class c : implClass.getInterfaces()) {
if (CoprocessorProtocol.class.isAssignableFrom(c)) {
masterServices.registerProtocol(c, (CoprocessorProtocol)instance);
break;
}
}
return new MasterEnvironment(implClass, instance, priority, seq, conf,
masterServices);
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:14,代码来源:MasterCoprocessorHost.java
示例13: createEnvironment
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
@Override
public RegionEnvironment createEnvironment(Class<?> implClass,
Coprocessor instance, int priority, int seq, Configuration conf) {
// Check if it's an Endpoint.
// Due to current dynamic protocol design, Endpoint
// uses a different way to be registered and executed.
// It uses a visitor pattern to invoke registered Endpoint
// method.
for (Class c : implClass.getInterfaces()) {
if (CoprocessorProtocol.class.isAssignableFrom(c)) {
region.registerProtocol(c, (CoprocessorProtocol)instance);
break;
}
}
ConcurrentMap<String, Object> classData;
// make sure only one thread can add maps
synchronized (sharedDataMap) {
// as long as at least one RegionEnvironment holds on to its classData it will
// remain in this map
classData = (ConcurrentMap<String, Object>)sharedDataMap.get(implClass.getName());
if (classData == null) {
classData = new ConcurrentHashMap<String, Object>();
sharedDataMap.put(implClass.getName(), classData);
}
}
return new RegionEnvironment(instance, priority, seq, conf, region,
rsServices, classData);
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:29,代码来源:RegionCoprocessorHost.java
示例14: coprocessorExec
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
@Override
public <T extends CoprocessorProtocol, R> Map<byte[], R> coprocessorExec(
Class<T> protocol, byte[] startKey, byte[] endKey, Call<T, R> callable) throws IOException,
Throwable {
// TODO Auto-generated method stub
return null;
}
开发者ID:aioaneid,项目名称:uzaygezen,代码行数:8,代码来源:MockHTable.java
示例15: coprocessorExec
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
public <T extends CoprocessorProtocol, R> Map<byte[], R> coprocessorExec(
String tableName, Class<T> paramClass, byte[] paramArrayOfByte1,
byte[] paramArrayOfByte2, Call<T, R> paramCall) throws IOException,
Throwable {
return poolableHConnection.coprocessorExec(tableName, paramClass,
paramArrayOfByte1, paramArrayOfByte2, paramCall);
}
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:8,代码来源:HzSessionImpl.java
示例16: coprocessorExec
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
public <T extends CoprocessorProtocol, R> void coprocessorExec(
Class<T> protocol, byte[] startKey, byte[] endKey,
Batch.Call<T, R> callable, Batch.Callback<R> callback)
throws IOException, Throwable {
this.delegate.coprocessorExec(protocol, startKey, endKey, callable,
callback);
}
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:8,代码来源:PoolableHTable.java
示例17: coprocessorProxy
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
public <T extends CoprocessorProtocol> T coprocessorProxy(String tableName, Class<T> paramClass,
byte[] paramArrayOfByte) {
try {
checkOpen();
HTableInterface table = getTable(tableName);
return table.coprocessorProxy(paramClass, paramArrayOfByte);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:11,代码来源:PoolableHConnection.java
示例18: coprocessorProxy
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
public <T extends CoprocessorProtocol> T coprocessorProxy(String tableName, Class<T> paramClass,
byte[] paramArrayOfByte) {
try {
return hzTemplate.coprocessorProxy(tableName, paramClass, paramArrayOfByte);
} catch (Exception ex) {
throw new HzBaoException(ex);
}
}
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:9,代码来源:HzBaoSupporter.java
示例19: coprocessorExec
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
public <T extends CoprocessorProtocol, R> Map<byte[], R> coprocessorExec(String tableName, Class<T> paramClass,
byte[] paramArrayOfByte1, byte[] paramArrayOfByte2, Call<T, R> paramCall) {
try {
return hzTemplate.coprocessorExec(tableName, paramClass, paramArrayOfByte1, paramArrayOfByte2, paramCall);
} catch (Throwable ex) {
throw new HzBaoException(ex);
}
}
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:9,代码来源:HzBaoSupporter.java
示例20: coprocessorProxy
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; //导入依赖的package包/类
public <T extends CoprocessorProtocol> T coprocessorProxy(String tableName, final Class<T> paramClass,
final byte[] paramArrayOfByte) {
return execute(tableName, new HzTableCallback<T>() {
public T doInAction(HTableInterface table) throws HzTemplateException {
try {
return table.coprocessorProxy(paramClass, paramArrayOfByte);
} catch (Exception ex) {
throw new HzTemplateException(ex);
}
}
});
}
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:13,代码来源:HzTemplateImpl.java
注:本文中的org.apache.hadoop.hbase.ipc.CoprocessorProtocol类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论