org.apache.hadoop.hbase.coprocessor
Class BaseRowProcessorEndpoint<S extends com.google.protobuf.Message,T extends com.google.protobuf.Message>
java.lang.Object
org.apache.hadoop.hbase.protobuf.generated.RowProcessorProtos.RowProcessorService
org.apache.hadoop.hbase.coprocessor.BaseRowProcessorEndpoint<S,T>
- All Implemented Interfaces:
- com.google.protobuf.Service, Coprocessor, CoprocessorService
@InterfaceAudience.LimitedPrivate(value="Coprocesssor")
@InterfaceStability.Evolving
public abstract class BaseRowProcessorEndpoint<S extends com.google.protobuf.Message,T extends com.google.protobuf.Message>
- extends RowProcessorProtos.RowProcessorService
- implements CoprocessorService, Coprocessor
This class demonstrates how to implement atomic read-modify-writes
using HRegion.processRowsWithLocks(org.apache.hadoop.hbase.regionserver.RowProcessor, ?>, long, long)
and Coprocessor endpoints.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BaseRowProcessorEndpoint
public BaseRowProcessorEndpoint()
process
public void process(com.google.protobuf.RpcController controller,
RowProcessorProtos.ProcessRequest request,
com.google.protobuf.RpcCallback<RowProcessorProtos.ProcessResponse> done)
- Pass a processor to HRegion to process multiple rows atomically.
The RowProcessor implementations should be the inner classes of your
RowProcessorEndpoint. This way the RowProcessor can be class-loaded with
the Coprocessor endpoint together.
See
TestRowProcessorEndpoint
for example.
The request contains information for constructing processor
(see constructRowProcessorFromRequest(org.apache.hadoop.hbase.protobuf.generated.RowProcessorProtos.ProcessRequest)
. The processor object defines
the read-modify-write procedure.
- Specified by:
process
in class RowProcessorProtos.RowProcessorService
getService
public com.google.protobuf.Service getService()
- Specified by:
getService
in interface CoprocessorService
start
public void start(CoprocessorEnvironment env)
throws IOException
- Stores a reference to the coprocessor environment provided by the
RegionCoprocessorHost
from the region where this
coprocessor is loaded. Since this is a coprocessor endpoint, it always expects to be loaded
on a table region, so always expects this to be an instance of
RegionCoprocessorEnvironment
.
- Specified by:
start
in interface Coprocessor
- Parameters:
env
- the environment provided by the coprocessor host
- Throws:
IOException
- if the provided environment is not an instance of
RegionCoprocessorEnvironment
stop
public void stop(CoprocessorEnvironment env)
throws IOException
- Specified by:
stop
in interface Coprocessor
- Throws:
IOException
Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.