Java Code Examples for org.apache.hadoop.service.ServiceOperations#stop()

The following examples show how to use org.apache.hadoop.service.ServiceOperations#stop() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestSecureRegistry.java    From big-c with Apache License 2.0 6 votes vote down vote up
/**
 * have the ZK user create the root dir.
 * This logs out the ZK user after and stops its curator instance,
 * to avoid contamination
 * @throws Throwable
 */
public void userZookeeperToCreateRoot() throws Throwable {

  System.setProperty("curator-log-events", "true");
  CuratorService curator = null;
  LoginContext login = login(ZOOKEEPER_LOCALHOST,
      ZOOKEEPER_CLIENT_CONTEXT,
      keytab_zk);
  try {
    logLoginDetails(ZOOKEEPER, login);
    RegistrySecurity.setZKSaslClientProperties(ZOOKEEPER,
        ZOOKEEPER_CLIENT_CONTEXT);
    curator = startCuratorServiceInstance("ZK", true);
    LOG.info(curator.toString());

    addToTeardown(curator);
    curator.zkMkPath("/", CreateMode.PERSISTENT, false,
        RegistrySecurity.WorldReadWriteACL);
    ZKPathDumper pathDumper = curator.dumpPath(true);
    LOG.info(pathDumper.toString());
  } finally {
    logout(login);
    ServiceOperations.stop(curator);
  }
}
 
Example 2
Source File: TestSecureRegistry.java    From hadoop with Apache License 2.0 6 votes vote down vote up
/**
 * have the ZK user create the root dir.
 * This logs out the ZK user after and stops its curator instance,
 * to avoid contamination
 * @throws Throwable
 */
public void userZookeeperToCreateRoot() throws Throwable {

  System.setProperty("curator-log-events", "true");
  CuratorService curator = null;
  LoginContext login = login(ZOOKEEPER_LOCALHOST,
      ZOOKEEPER_CLIENT_CONTEXT,
      keytab_zk);
  try {
    logLoginDetails(ZOOKEEPER, login);
    RegistrySecurity.setZKSaslClientProperties(ZOOKEEPER,
        ZOOKEEPER_CLIENT_CONTEXT);
    curator = startCuratorServiceInstance("ZK", true);
    LOG.info(curator.toString());

    addToTeardown(curator);
    curator.zkMkPath("/", CreateMode.PERSISTENT, false,
        RegistrySecurity.WorldReadWriteACL);
    ZKPathDumper pathDumper = curator.dumpPath(true);
    LOG.info(pathDumper.toString());
  } finally {
    logout(login);
    ServiceOperations.stop(curator);
  }
}
 
Example 3
Source File: TestNodeStatusUpdater.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@After
public void tearDown() {
  this.registeredNodes.clear();
  heartBeatID = 0;
  ServiceOperations.stop(nm);
  assertionFailedInThread.set(false);
  DefaultMetricsSystem.shutdown();
}
 
Example 4
Source File: AbstractSecureRegistryTest.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Stop the secure ZK and log out the ZK account
 */
public synchronized void stopSecureZK() {
  ServiceOperations.stop(secureZK);
  secureZK = null;
  logout(zookeeperLogin);
  zookeeperLogin = null;
}
 
Example 5
Source File: TestSecureRegistry.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * test that ZK can write as itself
 * @throws Throwable
 */
@Test
public void testZookeeperCanWrite() throws Throwable {

  System.setProperty("curator-log-events", "true");
  startSecureZK();
  CuratorService curator = null;
  LoginContext login = login(ZOOKEEPER_LOCALHOST,
      ZOOKEEPER_CLIENT_CONTEXT,
      keytab_zk);
  try {
    logLoginDetails(ZOOKEEPER, login);
    RegistrySecurity.setZKSaslClientProperties(ZOOKEEPER,
                                              ZOOKEEPER_CLIENT_CONTEXT);
    curator = startCuratorServiceInstance("ZK", true);
    LOG.info(curator.toString());

    addToTeardown(curator);
    curator.zkMkPath("/", CreateMode.PERSISTENT, false,
        RegistrySecurity.WorldReadWriteACL);
    curator.zkList("/");
    curator.zkMkPath("/zookeeper", CreateMode.PERSISTENT, false,
        RegistrySecurity.WorldReadWriteACL);
  } finally {
    logout(login);
    ServiceOperations.stop(curator);
  }
}
 
Example 6
Source File: TestSecureRegistry.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * test that ZK can write as itself
 * @throws Throwable
 */
@Test
public void testZookeeperCanWrite() throws Throwable {

  System.setProperty("curator-log-events", "true");
  startSecureZK();
  CuratorService curator = null;
  LoginContext login = login(ZOOKEEPER_LOCALHOST,
      ZOOKEEPER_CLIENT_CONTEXT,
      keytab_zk);
  try {
    logLoginDetails(ZOOKEEPER, login);
    RegistrySecurity.setZKSaslClientProperties(ZOOKEEPER,
                                              ZOOKEEPER_CLIENT_CONTEXT);
    curator = startCuratorServiceInstance("ZK", true);
    LOG.info(curator.toString());

    addToTeardown(curator);
    curator.zkMkPath("/", CreateMode.PERSISTENT, false,
        RegistrySecurity.WorldReadWriteACL);
    curator.zkList("/");
    curator.zkMkPath("/zookeeper", CreateMode.PERSISTENT, false,
        RegistrySecurity.WorldReadWriteACL);
  } finally {
    logout(login);
    ServiceOperations.stop(curator);
  }
}
 
Example 7
Source File: AbstractSecureRegistryTest.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Stop the secure ZK and log out the ZK account
 */
public synchronized void stopSecureZK() {
  ServiceOperations.stop(secureZK);
  secureZK = null;
  logout(zookeeperLogin);
  zookeeperLogin = null;
}
 
Example 8
Source File: TestNodeStatusUpdater.java    From big-c with Apache License 2.0 5 votes vote down vote up
@After
public void tearDown() {
  this.registeredNodes.clear();
  heartBeatID = 0;
  ServiceOperations.stop(nm);
  assertionFailedInThread.set(false);
  DefaultMetricsSystem.shutdown();
}
 
Example 9
Source File: MRAppMaster.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
protected void serviceStop() throws Exception {
  ServiceOperations.stop((Service) this.containerLauncher);
  super.serviceStop();
}
 
Example 10
Source File: MRAppMaster.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
protected void serviceStop() throws Exception {
  ServiceOperations.stop((Service) this.containerAllocator);
  super.serviceStop();
}
 
Example 11
Source File: TestMicroZookeeperService.java    From big-c with Apache License 2.0 4 votes vote down vote up
@After
public void destroyZKServer() throws IOException {

  ServiceOperations.stop(zookeeper);
}
 
Example 12
Source File: TestCuratorService.java    From big-c with Apache License 2.0 4 votes vote down vote up
@After
public void stopCurator() {
  ServiceOperations.stop(curatorService);
}
 
Example 13
Source File: TestNMClientAsync.java    From big-c with Apache License 2.0 4 votes vote down vote up
@After
public void teardown() {
  ServiceOperations.stop(asyncClient);
}
 
Example 14
Source File: MRAppMaster.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
protected void serviceStop() throws Exception {
  ServiceOperations.stop((Service) this.containerLauncher);
  super.serviceStop();
}
 
Example 15
Source File: MRAppMaster.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
protected void serviceStop() throws Exception {
  ServiceOperations.stop((Service) this.containerAllocator);
  super.serviceStop();
}
 
Example 16
Source File: TestMicroZookeeperService.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@After
public void destroyZKServer() throws IOException {

  ServiceOperations.stop(zookeeper);
}
 
Example 17
Source File: TestCuratorService.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@After
public void stopCurator() {
  ServiceOperations.stop(curatorService);
}
 
Example 18
Source File: TestNMClientAsync.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@After
public void teardown() {
  ServiceOperations.stop(asyncClient);
}