private void stopAtException(Exception e){ try { this.stop(); } catch (Exception ex) { LOG.warn("Encountered exception when handling exception (" + e.getMessage() + "):", ex); } }
public void stopNameNode(NameNode nn) { if (nn != null) { nn.stop(); } }
public void shutdown() { if (nameNode != null) { nameNode.stop(); } }
@Override protected void doDelete(NameNode service) throws Exception { service.stop(); }
void close() throws IOException { nameNode.stop(); }
public void stopNameNode(NameNode nn) { if (nn != null) { nn.stop(); } }
/** * Shutdown namenode. */ public synchronized void shutdownNameNode() { if (nameNode != null) { System.out.println("Shutting down the namenode"); nameNode.stop(); nameNode.join(); nameNode = null; } }
void close() { if(nameNode != null) nameNode.stop(); }
/** * Create a NameNode at the specified location and start it. * * The conf will be modified to reflect the actual ports on which * the NameNode is up and running if the user passes the port as * <code>zero</code>. */ public NameNode(String bindAddress, Configuration conf ) throws IOException { try { initialize(bindAddress, conf); } catch (IOException e) { this.stop(); throw e; } }
/** * Shut down the servers that are up. */ public void shutdown() { System.out.println("Shutting down the Mini HDFS Cluster"); shutdownDataNodes(); if (nameNode != null) { nameNode.stop(); nameNode.join(); nameNode = null; } }
@AfterClass public static void teardownCluster() { if (namenode != null) { namenode.stop(); } } }
@After public void tearDown() throws Exception { namenode.stop(); }
@AfterClass public static void teardownCluster() { if (namenode != null) namenode.stop(); }
/** * Shutdown the namenode at a given index. */ public synchronized void shutdownNameNode(int nnIndex) { NameNode nn = nameNodes[nnIndex].nameNode; if (nn != null) { LOG.info("Shutting down the namenode"); nn.stop(); nn.join(); Configuration conf = nameNodes[nnIndex].conf; nameNodes[nnIndex] = new NameNodeInfo(null, null, null, null, conf); } }
protected void startPostSafeModeProcessing() { // if not done yet, initialize replication queues if (!namesystem.isPopulatingReplQueues()) { initializeReplQueues(); } long timeInSafemode = FSNamesystem.now() - namesystem.systemStart; NameNode.stateChangeLog.info("STATE* Leaving safe mode after " + timeInSafemode / 1000 + " secs."); NameNode.getNameNodeMetrics().safeModeTime.set((int) timeInSafemode); if (reached >= 0) { NameNode.stateChangeLog.info("STATE* Safe mode is OFF."); } reached = -1; try { nameNode.startServerForClientRequests(); } catch (IOException ex) { nameNode.stop(); } NameNode.stateChangeLog.info("STATE* Network topology has " + namesystem.clusterMap.getNumOfRacks() + " racks and " + namesystem.clusterMap.getNumOfLeaves() + " datanodes"); NameNode.stateChangeLog.info("STATE* UnderReplicatedBlocks has " + namesystem.getUnderReplicatedBlocks() + " blocks"); }
private void checkNameSpace(Configuration conf) throws IOException { NameNode namenode = new NameNode(conf); assertTrue(namenode.getFileInfo("/test").isDir()); namenode.setSafeMode(SafeModeAction.SAFEMODE_ENTER); namenode.saveNamespace(); namenode.stop(); namenode.join(); }
/** * Tests setting the rpc port to the same as the web port to test that * an exception * is thrown when trying to re-use the same port */ @Test(expected = BindException.class, timeout = 300000) public void testThatMatchingRPCandHttpPortsThrowException() throws IOException { NameNode nameNode = null; try { Configuration conf = new HdfsConfiguration(); File nameDir = new File(MiniDFSCluster.getBaseDirectory(), "name"); conf.set(DFSConfigKeys.DFS_NAMENODE_NAME_DIR_KEY, nameDir.getAbsolutePath()); Random rand = new Random(); final int port = 30000 + rand.nextInt(30000); // set both of these to the same port. It should fail. FileSystem.setDefaultUri(conf, "hdfs://localhost:" + port); conf.set(DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY, "127.0.0.1:" + port); DFSTestUtil.formatNameNode(conf); nameNode = new NameNode(conf); } finally { if (nameNode != null) { nameNode.stop(); } } }
/** * Shutdown all the nodes in the cluster. */ public void shutdown(boolean deleteDfsDir) { LOG.info("Shutting down the Mini HDFS Cluster"); if (checkExitOnShutdown) { if (ExitUtil.terminateCalled()) { LOG.fatal("Test resulted in an unexpected exit", ExitUtil.getFirstExitException()); ExitUtil.resetFirstExitException(); throw new AssertionError("Test resulted in an unexpected exit"); } } shutdownDataNodes(); for (NameNodeInfo nnInfo : nameNodes) { if (nnInfo == null) continue; NameNode nameNode = nnInfo.nameNode; if (nameNode != null) { nameNode.stop(); nameNode.join(); nameNode = null; } } if (deleteDfsDir) { base_dir.delete(); } else { base_dir.deleteOnExit(); } }
private void checkNameSpace(Configuration conf) throws IOException { NameNode namenode = new NameNode(conf); NamenodeProtocols nnRpc = namenode.getRpcServer(); assertTrue(nnRpc.getFileInfo("/test").isDir()); nnRpc.setSafeMode(SafeModeAction.SAFEMODE_ENTER, false); nnRpc.saveNamespace(); namenode.stop(); namenode.join(); }