@Override public void setup(Stoppable parent, RegionCoprocessorEnvironment env) { setup(parent, env.getRegionServerServices()); }
try { final RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e; String serverName = env.getRegionServerServices().getServerName().getServerName(); if (env.getConfiguration().getBoolean(CHECK_VERSION_CONF_KEY, true)) { if (errormsg != null) { IOException ioe = new IOException(errormsg); env.getRegionServerServices().abort(errormsg, ioe); throw ioe; log = env.getRegionServerServices().getWAL();
private static ThreadPoolBuilder getPoolBuilder(RegionCoprocessorEnvironment env) { String serverName = env.getRegionServerServices().getServerName().getServerName(); return new ThreadPoolBuilder(serverName + "-index-builder", env.getConfiguration()). setCoreTimeout(INDEX_BUILDER_KEEP_ALIVE_TIME_CONF_KEY). setMaxThread(NUM_CONCURRENT_INDEX_BUILDER_THREADS_CONF_KEY, DEFAULT_CONCURRENT_INDEX_BUILDER_THREADS); }
@Override public void setup(IndexWriter parent, RegionCoprocessorEnvironment env, String name) { Configuration conf = env.getConfiguration(); setup(IndexWriterUtils.getDefaultDelegateHTableFactory(env), ThreadPoolManager.getExecutor( new ThreadPoolBuilder(name, conf). setMaxThread(NUM_CONCURRENT_INDEX_WRITER_THREADS_CONF_KEY, DEFAULT_CONCURRENT_INDEX_WRITER_THREADS). setCoreTimeout(INDEX_WRITER_KEEP_ALIVE_TIME_CONF_KEY), env), env.getRegionServerServices(), parent, CachingHTableFactory.getCacheSize(conf)); }
@Override public void setup(IndexWriter parent, RegionCoprocessorEnvironment env, String name) { Configuration conf = env.getConfiguration(); setup(IndexWriterUtils.getDefaultDelegateHTableFactory(env), ThreadPoolManager.getExecutor( new ThreadPoolBuilder(name, conf). setMaxThread(NUM_CONCURRENT_INDEX_WRITER_THREADS_CONF_KEY, DEFAULT_CONCURRENT_INDEX_WRITER_THREADS). setCoreTimeout(INDEX_WRITER_KEEP_ALIVE_TIME_CONF_KEY), env), env.getRegionServerServices(), parent, CachingHTableFactory.getCacheSize(conf)); }
/** * Create an HBase Connection from the region server */ public static Connection newServerConnection(Configuration config, RegionCoprocessorEnvironment env) throws IOException { return new CoprocessorHConnection(config, (HRegionServer)env.getRegionServerServices()); }
@Override public void start(CoprocessorEnvironment env) { // if running at region if (env instanceof RegionCoprocessorEnvironment) { RegionCoprocessorEnvironment regionEnv = (RegionCoprocessorEnvironment)env; RpcServerInterface server = regionEnv.getRegionServerServices().getRpcServer(); SecretManager<?> mgr = ((RpcServer)server).getSecretManager(); if (mgr instanceof AuthenticationTokenSecretManager) { secretManager = (AuthenticationTokenSecretManager)mgr; } } }
@Override public void start(CoprocessorEnvironment e) throws IOException { RegionCoprocessorEnvironment re = (RegionCoprocessorEnvironment) e; if (!re.getSharedData().containsKey(zkkey)) { // there is a short race here // in the worst case we create a watcher that will be notified once re.getSharedData().putIfAbsent( zkkey, new ZKWatcher(re.getRegionServerServices().getZooKeeper() .getRecoverableZooKeeper().getZooKeeper())); } }
/** * Create an unmanaged {@link HConnection} based on the environment in which we are running the * coprocessor. The {@link HConnection} must be externally cleaned up (we bypass the usual HTable * cleanup mechanisms since we own everything). * @param env environment hosting the {@link HConnection} * @return an unmanaged {@link HConnection}. * @throws IOException if we cannot create the connection */ public static ClusterConnection getConnectionForEnvironment(CoprocessorEnvironment env) throws IOException { // this bit is a little hacky - just trying to get it going for the moment if (env instanceof RegionCoprocessorEnvironment) { RegionCoprocessorEnvironment e = (RegionCoprocessorEnvironment) env; RegionServerServices services = e.getRegionServerServices(); if (services instanceof HRegionServer) { return new CoprocessorHConnection((HRegionServer) services); } } return ConnectionManager.createConnectionInternal(env.getConfiguration()); }
@Override public void init(RegionCoprocessorEnvironment e) throws IOException { ZooKeeperWatcher zk = e.getRegionServerServices().getZooKeeper(); try { labelsCache = VisibilityLabelsCache.createAndGet(zk, this.conf);
zk = regionEnv.getRegionServerServices().getZooKeeper(); compatibleEarlyTermination = conf.getBoolean(AccessControlConstants.CF_ATTRIBUTE_EARLY_OUT, AccessControlConstants.DEFAULT_ATTRIBUTE_EARLY_OUT);