本文整理汇总了Java中org.apache.hadoop.hbase.ipc.VersionedProtocol类的典型用法代码示例。如果您正苦于以下问题:Java VersionedProtocol类的具体用法?Java VersionedProtocol怎么用?Java VersionedProtocol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VersionedProtocol类属于org.apache.hadoop.hbase.ipc包,在下文中一共展示了VersionedProtocol类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProxy
import org.apache.hadoop.hbase.ipc.VersionedProtocol; //导入依赖的package包/类
/** Construct a client-side proxy object that implements the named protocol,
* talking to a server at the named address. */
public VersionedProtocol getProxy(
Class<? extends VersionedProtocol> protocol, long clientVersion,
InetSocketAddress addr, User ticket,
Configuration conf, SocketFactory factory, int rpcTimeout)
throws IOException {
VersionedProtocol proxy =
(VersionedProtocol) Proxy.newProxyInstance(
protocol.getClassLoader(), new Class[] { protocol },
new Invoker(protocol, addr, ticket, conf, factory, rpcTimeout));
if (proxy instanceof VersionedProtocol) {
long serverVersion = ((VersionedProtocol)proxy)
.getProtocolVersion(protocol.getName(), clientVersion);
if (serverVersion != clientVersion) {
throw new HBaseRPC.VersionMismatch(protocol.getName(), clientVersion,
serverVersion);
}
}
return proxy;
}
示例2: Invoker
import org.apache.hadoop.hbase.ipc.VersionedProtocol; //导入依赖的package包/类
public Invoker(HBaseClient client,
Class<? extends VersionedProtocol> protocol,
InetSocketAddress address, User ticket,
Configuration conf, int rpcTimeout) {
this.protocol = protocol;
this.address = address;
this.ticket = ticket;
this.client = client;
this.rpcTimeout = rpcTimeout;
}
示例3: getProxy
import org.apache.hadoop.hbase.ipc.VersionedProtocol; //导入依赖的package包/类
/** Construct a client-side proxy object that implements the named protocol,
* talking to a server at the named address. */
@Override
public <T extends VersionedProtocol> T getProxy(
Class<T> protocol, long clientVersion,
InetSocketAddress addr, Configuration conf, int rpcTimeout)
throws IOException {
if (this.client == null) {
throw new IOException("Client must be initialized by calling setConf(Configuration)");
}
T proxy =
(T) Proxy.newProxyInstance(
protocol.getClassLoader(), new Class[] { protocol },
new Invoker(client, protocol, addr, userProvider.getCurrent(), conf,
HBaseRPC.getRpcTimeout(rpcTimeout)));
/*
* TODO: checking protocol version only needs to be done once when we setup a new
* HBaseClient.Connection. Doing it every time we retrieve a proxy instance is resulting
* in unnecessary RPC traffic.
*/
long serverVersion = ((VersionedProtocol)proxy)
.getProtocolVersion(protocol.getName(), clientVersion);
if (serverVersion != clientVersion) {
throw new HBaseRPC.VersionMismatch(protocol.getName(), clientVersion,
serverVersion);
}
return proxy;
}
示例4: call
import org.apache.hadoop.hbase.ipc.VersionedProtocol; //导入依赖的package包/类
/** Expert: Make multiple, parallel calls to a set of servers. */
@Override
public Object[] call(Method method, Object[][] params,
InetSocketAddress[] addrs,
Class<? extends VersionedProtocol> protocol,
User ticket, Configuration conf)
throws IOException, InterruptedException {
if (this.client == null) {
throw new IOException("Client must be initialized by calling setConf(Configuration)");
}
Invocation[] invocations = new Invocation[params.length];
for (int i = 0; i < params.length; i++) {
invocations[i] = new Invocation(method, protocol, params[i]);
}
Writable[] wrappedValues =
client.call(invocations, addrs, protocol, ticket);
if (method.getReturnType() == Void.TYPE) {
return null;
}
Object[] values =
(Object[])Array.newInstance(method.getReturnType(), wrappedValues.length);
for (int i = 0; i < values.length; i++) {
if (wrappedValues[i] != null) {
values[i] = ((HbaseObjectWritable)wrappedValues[i]).get();
}
}
return values;
}
示例5: getServer
import org.apache.hadoop.hbase.ipc.VersionedProtocol; //导入依赖的package包/类
/** Construct a server for a protocol implementation instance listening on a
* port and address. */
public Server getServer(Class<? extends VersionedProtocol> protocol,
Object instance,
Class<?>[] ifaces,
String bindAddress, int port,
int numHandlers,
int metaHandlerCount, boolean verbose,
Configuration conf, int highPriorityLevel)
throws IOException {
return new Server(instance, ifaces, conf, bindAddress, port, numHandlers,
metaHandlerCount, verbose, highPriorityLevel);
}
示例6: Invoker
import org.apache.hadoop.hbase.ipc.VersionedProtocol; //导入依赖的package包/类
public Invoker(Class<? extends VersionedProtocol> protocol,
InetSocketAddress address, User ticket,
Configuration conf, SocketFactory factory, int rpcTimeout) {
this.protocol = protocol;
this.address = address;
this.ticket = ticket;
this.client = CLIENTS.getClient(conf, factory);
this.rpcTimeout = rpcTimeout;
}
示例7: call
import org.apache.hadoop.hbase.ipc.VersionedProtocol; //导入依赖的package包/类
/** Expert: Make multiple, parallel calls to a set of servers. */
public Object[] call(Method method, Object[][] params,
InetSocketAddress[] addrs,
Class<? extends VersionedProtocol> protocol,
User ticket, Configuration conf)
throws IOException, InterruptedException {
Invocation[] invocations = new Invocation[params.length];
for (int i = 0; i < params.length; i++)
invocations[i] = new Invocation(method, params[i]);
HBaseClient client = CLIENTS.getClient(conf);
try {
Writable[] wrappedValues =
client.call(invocations, addrs, protocol, ticket);
if (method.getReturnType() == Void.TYPE) {
return null;
}
Object[] values =
(Object[])Array.newInstance(method.getReturnType(), wrappedValues.length);
for (int i = 0; i < values.length; i++)
if (wrappedValues[i] != null)
values[i] = ((HbaseObjectWritable)wrappedValues[i]).get();
return values;
} finally {
CLIENTS.stopClient(client);
}
}
示例8: getProxy
import org.apache.hadoop.hbase.ipc.VersionedProtocol; //导入依赖的package包/类
/** Construct a client-side proxy object that implements the named protocol,
* talking to a server at the named address. */
@Override
public <T extends VersionedProtocol> T getProxy(
Class<T> protocol, long clientVersion,
InetSocketAddress addr, Configuration conf, int rpcTimeout)
throws IOException {
if (this.client == null) {
throw new IOException("Client must be initialized by calling setConf(Configuration)");
}
T proxy =
(T) Proxy.newProxyInstance(
protocol.getClassLoader(), new Class[] { protocol },
new Invoker(client, protocol, addr, User.getCurrent(), conf,
HBaseRPC.getRpcTimeout(rpcTimeout)));
/*
* TODO: checking protocol version only needs to be done once when we setup a new
* HBaseClient.Connection. Doing it every time we retrieve a proxy instance is resulting
* in unnecessary RPC traffic.
*/
long serverVersion = ((VersionedProtocol)proxy)
.getProtocolVersion(protocol.getName(), clientVersion);
if (serverVersion != clientVersion) {
throw new HBaseRPC.VersionMismatch(protocol.getName(), clientVersion,
serverVersion);
}
return proxy;
}
示例9: initMethods
import org.apache.hadoop.hbase.ipc.VersionedProtocol; //导入依赖的package包/类
private void initMethods(Class<? extends VersionedProtocol> protocol) {
for (Method m : protocol.getDeclaredMethods()) {
if (get(m.getName()) == null)
create(m.getName());
}
}
示例10: stopProxy
import org.apache.hadoop.hbase.ipc.VersionedProtocol; //导入依赖的package包/类
/**
* Stop this proxy and release its invoker's resource
* @param proxy the proxy to be stopped
*/
public void stopProxy(VersionedProtocol proxy) {
if (proxy!=null) {
((Invoker)Proxy.getInvocationHandler(proxy)).close();
}
}
示例11: getProxy
import org.apache.hadoop.hbase.ipc.VersionedProtocol; //导入依赖的package包/类
/** Construct a client-side proxy object. */
VersionedProtocol getProxy(Class<? extends VersionedProtocol> protocol,
long clientVersion, InetSocketAddress addr,
User ticket, Configuration conf,
SocketFactory factory, int rpcTimeout) throws IOException;
示例12: stopProxy
import org.apache.hadoop.hbase.ipc.VersionedProtocol; //导入依赖的package包/类
/** Stop this proxy. */
void stopProxy(VersionedProtocol proxy);
示例13: call
import org.apache.hadoop.hbase.ipc.VersionedProtocol; //导入依赖的package包/类
/** Expert: Make multiple, parallel calls to a set of servers. */
Object[] call(Method method, Object[][] params, InetSocketAddress[] addrs,
Class<? extends VersionedProtocol> protocol,
User ticket, Configuration conf)
throws IOException, InterruptedException;
示例14: getServer
import org.apache.hadoop.hbase.ipc.VersionedProtocol; //导入依赖的package包/类
/** Construct a server for a protocol implementation instance. */
RpcServer getServer(Class<? extends VersionedProtocol> protocol, Object instance,
Class<?>[] ifaces, String bindAddress,
int port, int numHandlers, int metaHandlerCount,
boolean verbose, Configuration conf, int highPriorityLevel)
throws IOException;