org.apache.hadoop.hbase.client.coprocessor
Class Batch

java.lang.Object
  extended by org.apache.hadoop.hbase.client.coprocessor.Batch

public abstract class Batch
extends Object

A collection of interfaces and utilities used for interacting with custom RPC interfaces exposed by Coprocessors.


Nested Class Summary
static interface Batch.Call<T,R>
          Defines a unit of work to be executed.
static interface Batch.Callback<R>
          Defines a generic callback to be triggered for each Batch.Call.call(Object) result.
 
Constructor Summary
Batch()
           
 
Method Summary
static
<T extends CoprocessorProtocol,R>
Batch.Call<T,R>
forMethod(Class<T> protocol, String method, Object... args)
          Creates a new Batch.Call instance that invokes a method with the given parameters and returns the result.
static
<T extends CoprocessorProtocol,R>
Batch.Call<T,R>
forMethod(Method method, Object... args)
          Creates a new Batch.Call instance that invokes a method with the given parameters and returns the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Batch

public Batch()
Method Detail

forMethod

public static <T extends CoprocessorProtocol,R> Batch.Call<T,R> forMethod(Class<T> protocol,
                                                                          String method,
                                                                          Object... args)
                                                             throws NoSuchMethodException
Creates a new Batch.Call instance that invokes a method with the given parameters and returns the result.

Note that currently the method is naively looked up using the method name and class types of the passed arguments, which means that none of the arguments can be null. For more flexibility, see forMethod(java.lang.reflect.Method, Object...).

Type Parameters:
T - the class type of the protocol implementation being invoked
R - the return type for the method call
Parameters:
protocol - the protocol class being called
method - the method name
args - zero or more arguments to be passed to the method (individual args cannot be null!)
Returns:
a Callable instance that will invoke the given method and return the results
Throws:
NoSuchMethodException - if the method named, with the given argument types, cannot be found in the protocol class
See Also:
forMethod(java.lang.reflect.Method, Object...), HTable.coprocessorExec(Class, byte[], byte[], org.apache.hadoop.hbase.client.coprocessor.Batch.Call, org.apache.hadoop.hbase.client.coprocessor.Batch.Callback)

forMethod

public static <T extends CoprocessorProtocol,R> Batch.Call<T,R> forMethod(Method method,
                                                                          Object... args)
Creates a new Batch.Call instance that invokes a method with the given parameters and returns the result.

Type Parameters:
T - the class type of the protocol implementation being invoked
R - the return type for the method call
Parameters:
method - the method reference to invoke
args - zero or more arguments to be passed to the method
Returns:
a Callable instance that will invoke the given method and return the results
See Also:
HTable.coprocessorExec(Class, byte[], byte[], org.apache.hadoop.hbase.client.coprocessor.Batch.Call, org.apache.hadoop.hbase.client.coprocessor.Batch.Callback)


Copyright © 2014 The Apache Software Foundation. All Rights Reserved.