private static class RegionCoprocessorHost.RegionEnvironment extends BaseEnvironment<RegionCoprocessor> implements RegionCoprocessorEnvironment
Modifier and Type | Field and Description |
---|---|
private MetricRegistry |
metricRegistry |
private Region |
region |
private RegionServerServices |
services |
(package private) ConcurrentMap<String,Object> |
sharedData |
impl, priority
Constructor and Description |
---|
RegionEnvironment(RegionCoprocessor impl,
int priority,
int seq,
org.apache.hadoop.conf.Configuration conf,
Region region,
RegionServerServices services,
ConcurrentMap<String,Object> sharedData)
Constructor
|
Modifier and Type | Method and Description |
---|---|
Connection |
createConnection(org.apache.hadoop.conf.Configuration conf)
Creates a cluster connection using the passed Configuration.
|
RawCellBuilder |
getCellBuilder()
Returns a CellBuilder so that coprocessors can build cells.
|
Connection |
getConnection()
Returns the hosts' Connection to the Cluster.
|
MetricRegistry |
getMetricRegistryForRegionServer()
Returns a MetricRegistry that can be used to track metrics at the region server level.
|
OnlineRegions |
getOnlineRegions()
Returns Interface to Map of regions online on this RegionServer
RegionCoprocessorEnvironment.getServerName() }. |
Region |
getRegion()
Returns the region
|
RegionInfo |
getRegionInfo()
Returns region information for the region this coprocessor is running on
|
ServerName |
getServerName()
Returns Hosting Server's ServerName
|
ConcurrentMap<String,Object> |
getSharedData()
Returns shared data between all instances of this coprocessor
|
void |
shutdown()
Clean up the environment
|
getClassLoader, getConfiguration, getHBaseVersion, getInstance, getLoadSequence, getPriority, getVersion, startup
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getClassLoader, getConfiguration, getHBaseVersion, getInstance, getLoadSequence, getPriority, getVersion
ConcurrentMap<String,Object> sharedData
private final MetricRegistry metricRegistry
private final RegionServerServices services
public RegionEnvironment(RegionCoprocessor impl, int priority, int seq, org.apache.hadoop.conf.Configuration conf, Region region, RegionServerServices services, ConcurrentMap<String,Object> sharedData)
impl
- the coprocessor instancepriority
- chaining prioritypublic Region getRegion()
getRegion
in interface RegionCoprocessorEnvironment
public OnlineRegions getOnlineRegions()
RegionCoprocessorEnvironment
RegionCoprocessorEnvironment.getServerName()
}.getOnlineRegions
in interface RegionCoprocessorEnvironment
public Connection getConnection()
RegionCoprocessorEnvironment
UnsupportedOperationException
if you try to close or abort
it. For light-weight usage only. Heavy-duty usage will pull down the hosting RegionServer
responsiveness as well as that of other Coprocessors making use of this Connection. Use to
create table on start or to do administrative operations. Coprocessors should create their own
Connections if heavy usage to avoid impinging on hosting Server operation. To create a
Connection or if a Coprocessor requires a region with a particular Configuration, use
ConnectionFactory
or
RegionCoprocessorEnvironment.createConnection(Configuration)
}.
Be aware that operations that make use of this Connection are executed as the RegionServer
User, the hbase super user that started this server process. Exercise caution running
operations as this User (See RegionCoprocessorEnvironment.createConnection(Configuration)
} to run as other than the
RegionServer User).
Be careful RPC'ing from a Coprocessor context. RPC's will fail, stall, retry, and/or crawl because the remote side is not online, is struggling or it is on the other side of a network partition. Any use of Connection from inside a Coprocessor must be able to handle all such hiccups.
NOTE: the returned Connection is created using User.getCurrent()
,so the Connection is as
the System User who running the RegionServer, not the client User who initiate the RPC.
getConnection
in interface RegionCoprocessorEnvironment
RegionCoprocessorEnvironment.createConnection(Configuration)
public Connection createConnection(org.apache.hadoop.conf.Configuration conf) throws IOException
RegionCoprocessorEnvironment
ConnectionFactory.createConnection(Configuration)
returns a Connection that will short-circuit RPC if the target is a local resource. Use
ConnectionFactory if you don't need this ability.
Be careful RPC'ing from a Coprocessor context. RPC's will fail, stall, retry, and/or crawl because the remote side is not online, is struggling or it is on the other side of a network partition. Any use of Connection from inside a Coprocessor must be able to handle all such hiccups.
NOTE: the returned Connection is created using User.getCurrent()
,so the Connection is as
the System User who running the RegionServer, not the client User who initiate the RPC.
createConnection
in interface RegionCoprocessorEnvironment
IOException
public ServerName getServerName()
RegionCoprocessorEnvironment
getServerName
in interface RegionCoprocessorEnvironment
public void shutdown()
BaseEnvironment
shutdown
in class BaseEnvironment<RegionCoprocessor>
public ConcurrentMap<String,Object> getSharedData()
RegionCoprocessorEnvironment
getSharedData
in interface RegionCoprocessorEnvironment
public RegionInfo getRegionInfo()
RegionCoprocessorEnvironment
getRegionInfo
in interface RegionCoprocessorEnvironment
public MetricRegistry getMetricRegistryForRegionServer()
RegionCoprocessorEnvironment
See ExampleRegionObserverWithMetrics class in the hbase-examples modules to see examples of how metrics can be instantiated and used.
getMetricRegistryForRegionServer
in interface RegionCoprocessorEnvironment
public RawCellBuilder getCellBuilder()
RegionCoprocessorEnvironment
getCellBuilder
in interface RegionCoprocessorEnvironment
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.