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

The following examples show how to use org.apache.hadoop.service.ServiceOperations#stop() . These examples are extracted from open source projects. 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 Project: hadoop   File: TestSecureRegistry.java    License: 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 Project: big-c   File: TestSecureRegistry.java    License: 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 Project: hadoop   File: TestNodeStatusUpdater.java    License: 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
/**
 * 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 Project: hadoop   File: TestSecureRegistry.java    License: 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 Project: big-c   File: TestNodeStatusUpdater.java    License: 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 7
/**
 * 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 Project: big-c   File: TestSecureRegistry.java    License: 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 9
Source Project: hadoop   File: TestNMClientAsync.java    License: Apache License 2.0 4 votes vote down vote up
@After
public void teardown() {
  ServiceOperations.stop(asyncClient);
}
 
Example 10
Source Project: hadoop   File: TestCuratorService.java    License: Apache License 2.0 4 votes vote down vote up
@After
public void stopCurator() {
  ServiceOperations.stop(curatorService);
}
 
Example 11
@After
public void destroyZKServer() throws IOException {

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

  ServiceOperations.stop(zookeeper);
}
 
Example 17
Source Project: big-c   File: MRAppMaster.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected void serviceStop() throws Exception {
  ServiceOperations.stop((Service) this.containerAllocator);
  super.serviceStop();
}
 
Example 18
Source Project: big-c   File: MRAppMaster.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected void serviceStop() throws Exception {
  ServiceOperations.stop((Service) this.containerLauncher);
  super.serviceStop();
}