@Override public void start(CoprocessorEnvironment env) throws IOException { if (!(env instanceof HasMasterServices)) { throw new IOException("Does not implement HMasterServices"); } master = ((HasMasterServices)env).getMasterServices(); groupInfoManager = RSGroupInfoManagerImpl.getInstance(master); groupAdminServer = new RSGroupAdminServer(master, groupInfoManager); Class<?> clazz = master.getConfiguration().getClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS, null); if (!RSGroupableBalancer.class.isAssignableFrom(clazz)) { throw new IOException("Configured balancer does not support RegionServer groups."); } ZKWatcher zk = ((HasMasterServices)env).getMasterServices().getZooKeeper(); accessChecker = new AccessChecker(env.getConfiguration(), zk); // set the user-provider. this.userProvider = UserProvider.instantiate(env.getConfiguration()); }
/** * Assert that when a Coprocessor is annotated with CoreCoprocessor, then it is possible to * access a MasterServices instance. Assert the opposite too. * Do it to MasterCoprocessors. * @throws IOException */ @Test public void testCoreRegionCoprocessor() throws IOException { MasterCoprocessorEnvironment env = this.mch.load(null, NotCoreMasterCoprocessor.class.getName(), 0, HTU.getConfiguration()); assertFalse(env instanceof HasMasterServices); env = this.mch.load(null, CoreMasterCoprocessor.class.getName(), 1, HTU.getConfiguration()); assertTrue(env instanceof HasMasterServices); assertEquals(this.ms, ((HasMasterServices)env).getMasterServices()); } }
zk = ((HasMasterServices)mEnv).getMasterServices().getZooKeeper();
@Override public void start(CoprocessorEnvironment env) throws IOException { if (!(env instanceof HasMasterServices)) { throw new IOException("Does not implement HMasterServices"); } master = ((HasMasterServices)env).getMasterServices(); groupInfoManager = RSGroupInfoManagerImpl.getInstance(master); groupAdminServer = new RSGroupAdminServer(master, groupInfoManager); Class<?> clazz = master.getConfiguration().getClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS, null); if (!RSGroupableBalancer.class.isAssignableFrom(clazz)) { throw new IOException("Configured balancer does not support RegionServer groups."); } ZKWatcher zk = ((HasMasterServices)env).getMasterServices().getZooKeeper(); accessChecker = new AccessChecker(env.getConfiguration(), zk); // set the user-provider. this.userProvider = UserProvider.instantiate(env.getConfiguration()); }
@Override public void start(CoprocessorEnvironment env) throws IOException { if (!(env instanceof HasMasterServices)) { throw new IOException("Does not implement HMasterServices"); } master = ((HasMasterServices)env).getMasterServices(); groupInfoManager = RSGroupInfoManagerImpl.getInstance(master); groupAdminServer = new RSGroupAdminServer(master, groupInfoManager); Class<?> clazz = master.getConfiguration().getClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS, null); if (!RSGroupableBalancer.class.isAssignableFrom(clazz)) { throw new IOException("Configured balancer does not support RegionServer groups."); } ZKWatcher zk = ((HasMasterServices)env).getMasterServices().getZooKeeper(); accessChecker = new AccessChecker(env.getConfiguration(), zk); // set the user-provider. this.userProvider = UserProvider.instantiate(env.getConfiguration()); }
/** * Assert that when a Coprocessor is annotated with CoreCoprocessor, then it is possible to * access a MasterServices instance. Assert the opposite too. * Do it to MasterCoprocessors. * @throws IOException */ @Test public void testCoreRegionCoprocessor() throws IOException { MasterCoprocessorEnvironment env = this.mch.load(null, NotCoreMasterCoprocessor.class.getName(), 0, HTU.getConfiguration()); assertFalse(env instanceof HasMasterServices); env = this.mch.load(null, CoreMasterCoprocessor.class.getName(), 1, HTU.getConfiguration()); assertTrue(env instanceof HasMasterServices); assertEquals(this.ms, ((HasMasterServices)env).getMasterServices()); } }