C
- type of specific coprocessor this host will handleE
- type of specific coprocessor environment this host requires.
provides@InterfaceAudience.Private public abstract class CoprocessorHost<C extends Coprocessor,E extends CoprocessorEnvironment<C>> extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
CoprocessorHost.ObserverGetter<C,O>
Implementations defined function to get an observer of type
O from a coprocessor of
type C . |
class |
CoprocessorHost.ObserverOperationWithoutResult<O> |
class |
CoprocessorHost.ObserverOperationWithResult<O,R> |
Modifier and Type | Field and Description |
---|---|
static String |
ABORT_ON_ERROR_KEY |
protected Abortable |
abortable |
protected org.apache.hadoop.conf.Configuration |
conf |
protected SortedList<E> |
coprocEnvironments
Ordered set of loaded coprocessors with lock
|
static String |
COPROCESSORS_ENABLED_CONF_KEY |
static boolean |
DEFAULT_ABORT_ON_ERROR |
static boolean |
DEFAULT_COPROCESSORS_ENABLED |
static boolean |
DEFAULT_USER_COPROCESSORS_ENABLED |
protected AtomicInteger |
loadSequence |
static String |
MASTER_COPROCESSOR_CONF_KEY |
protected String |
pathPrefix |
static String |
REGION_COPROCESSOR_CONF_KEY |
static String |
REGIONSERVER_COPROCESSOR_CONF_KEY |
static String |
USER_COPROCESSORS_ENABLED_CONF_KEY |
static String |
USER_REGION_COPROCESSOR_CONF_KEY |
static String |
WAL_COPROCESSOR_CONF_KEY |
Constructor and Description |
---|
CoprocessorHost(Abortable abortable) |
Modifier and Type | Method and Description |
---|---|
protected void |
abortServer(E environment,
Throwable e) |
protected void |
abortServer(String coprocessorName,
Throwable e) |
abstract C |
checkAndGetInstance(Class<?> implClass)
Called when a new Coprocessor class needs to be loaded.
|
E |
checkAndLoadInstance(Class<?> implClass,
int priority,
org.apache.hadoop.conf.Configuration conf) |
abstract E |
createEnvironment(C instance,
int priority,
int sequence,
org.apache.hadoop.conf.Configuration conf)
Called when a new Coprocessor class is loaded
|
protected <O> boolean |
execOperation(org.apache.hadoop.hbase.coprocessor.CoprocessorHost.ObserverOperation<O> observerOperation) |
protected <O,R> R |
execOperationWithResult(CoprocessorHost.ObserverOperationWithResult<O,R> observerOperation)
Do not call with an observerOperation that is null! Have the caller check.
|
protected <O> boolean |
execShutdown(org.apache.hadoop.hbase.coprocessor.CoprocessorHost.ObserverOperation<O> observerOperation)
Coprocessor classes can be configured in any order, based on that priority is set and
chained in a sorted order.
|
<T extends C> |
findCoprocessor(Class<T> cls) |
C |
findCoprocessor(String className)
Find coprocessors by full class name or simple name.
|
E |
findCoprocessorEnvironment(String className)
Find a coprocessor environment by class name
|
<T extends C> |
findCoprocessors(Class<T> cls)
Find list of coprocessors that extend/implement the given class/interface
|
Set<String> |
getCoprocessors()
Used to create a parameter to the HServerLoad constructor so that
HServerLoad can provide information about the coprocessors loaded by this
regionserver.
|
static Set<String> |
getLoadedCoprocessors() |
protected void |
handleCoprocessorThrowable(E env,
Throwable e)
This is used by coprocessor hooks which are declared to throw IOException
(or its subtypes).
|
void |
load(Class<? extends C> implClass,
int priority,
org.apache.hadoop.conf.Configuration conf) |
E |
load(org.apache.hadoop.fs.Path path,
String className,
int priority,
org.apache.hadoop.conf.Configuration conf)
Load a coprocessor implementation into the host
|
E |
load(org.apache.hadoop.fs.Path path,
String className,
int priority,
org.apache.hadoop.conf.Configuration conf,
String[] includedClassPrefixes)
Load a coprocessor implementation into the host
|
protected void |
loadSystemCoprocessors(org.apache.hadoop.conf.Configuration conf,
String confKey)
Load system coprocessors once only.
|
void |
shutdown(E e) |
public static final String REGION_COPROCESSOR_CONF_KEY
public static final String REGIONSERVER_COPROCESSOR_CONF_KEY
public static final String USER_REGION_COPROCESSOR_CONF_KEY
public static final String MASTER_COPROCESSOR_CONF_KEY
public static final String WAL_COPROCESSOR_CONF_KEY
public static final String ABORT_ON_ERROR_KEY
public static final boolean DEFAULT_ABORT_ON_ERROR
public static final String COPROCESSORS_ENABLED_CONF_KEY
public static final boolean DEFAULT_COPROCESSORS_ENABLED
public static final String USER_COPROCESSORS_ENABLED_CONF_KEY
public static final boolean DEFAULT_USER_COPROCESSORS_ENABLED
protected Abortable abortable
protected final SortedList<E extends CoprocessorEnvironment<C>> coprocEnvironments
protected org.apache.hadoop.conf.Configuration conf
protected String pathPrefix
protected AtomicInteger loadSequence
public CoprocessorHost(Abortable abortable)
public Set<String> getCoprocessors()
protected void loadSystemCoprocessors(org.apache.hadoop.conf.Configuration conf, String confKey)
public E load(org.apache.hadoop.fs.Path path, String className, int priority, org.apache.hadoop.conf.Configuration conf) throws IOException
path
- path to implementation jarclassName
- the main class namepriority
- chaining priorityconf
- configuration for coprocessorIOException
- Exceptionpublic E load(org.apache.hadoop.fs.Path path, String className, int priority, org.apache.hadoop.conf.Configuration conf, String[] includedClassPrefixes) throws IOException
path
- path to implementation jarclassName
- the main class namepriority
- chaining priorityconf
- configuration for coprocessorincludedClassPrefixes
- class name prefixes to includeIOException
- Exceptionpublic void load(Class<? extends C> implClass, int priority, org.apache.hadoop.conf.Configuration conf) throws IOException
IOException
public E checkAndLoadInstance(Class<?> implClass, int priority, org.apache.hadoop.conf.Configuration conf) throws IOException
implClass
- Implementation classpriority
- priorityconf
- configurationIOException
- Exceptionpublic abstract E createEnvironment(C instance, int priority, int sequence, org.apache.hadoop.conf.Configuration conf)
public abstract C checkAndGetInstance(Class<?> implClass) throws InstantiationException, IllegalAccessException
public void shutdown(E e)
public C findCoprocessor(String className)
public <T extends C> List<T> findCoprocessors(Class<T> cls)
cls
- the class/interface to look forpublic E findCoprocessorEnvironment(String className)
className
- the class nameprotected void handleCoprocessorThrowable(E env, Throwable e) throws IOException
env
- Coprocessor Environmente
- Throwable object thrown by coprocessor.IOException
- Exceptionprotected <O,R> R execOperationWithResult(CoprocessorHost.ObserverOperationWithResult<O,R> observerOperation) throws IOException
IOException
protected <O> boolean execOperation(org.apache.hadoop.hbase.coprocessor.CoprocessorHost.ObserverOperation<O> observerOperation) throws IOException
true
if
ObserverOperation#isBypassable().IOException
protected <O> boolean execShutdown(org.apache.hadoop.hbase.coprocessor.CoprocessorHost.ObserverOperation<O> observerOperation) throws IOException
IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.