public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { final boolean logDebug = LOG.isDebugEnabled(); long startTime = 0; if (logDebug) { startTime = System.currentTimeMillis(); } HbaseObjectWritable value = (HbaseObjectWritable) client.call(new Invocation(method, protocol, args), address, protocol, ticket, rpcTimeout); if (logDebug) { // FIGURE HOW TO TURN THIS OFF! long callTime = System.currentTimeMillis() - startTime; LOG.debug("Call: " + method.getName() + " " + callTime); } return value.get(); } }
/** 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; }