LOG.info("killing datanode " + name + " / " + lookup); ipcPort = dn.ipcServer.getListenerAddress().getPort(); dn.shutdown(); LOG.info("killed datanode " + name + " / " + lookup); break;
@Override public void run() { if (!shutdownForUpgrade) { // Delay the shutdown a bit if not doing for restart. try { Thread.sleep(1000); } catch (InterruptedException ie) { } } shutdown(); } };
startDataNode(dataDirs, resources); } catch (IOException ie) { shutdown(); throw ie;
/** * Stop the datanode. */ public void stopDataNode(DataNode dn) { if (dn != null) { dn.shutdown(); } }
@Override protected void doDelete(DataNode service) throws Exception { service.shutdown(); } }
public void shutdown() { if (dataNode != null) { dataNode.shutdown(); } else { ready = true; } }
@Override public void run() { if (!shutdownForUpgrade) { // Delay the shutdown a bit if not doing for restart. try { Thread.sleep(1000); } catch (InterruptedException ie) { } } shutdown(); } };
@Override public void run() { if (!shutdownForUpgrade) { // Delay the shutdown a bit if not doing for restart. try { Thread.sleep(1000); } catch (InterruptedException ie) { } } shutdown(); } };
/** * Shutdown all DataNodes started by this class. The NameNode * is left running so that new DataNodes may be started. */ public void shutdownDataNodes() { for (int i = dataNodes.size()-1; i >= 0; i--) { LOG.info("Shutting down DataNode " + i); DataNode dn = dataNodes.remove(i).datanode; dn.shutdown(); numDataNodes--; } }
/** Wait for the datanode to exit and clean up all its resources */ public void waitAndShutdown() { join(); // make sure all other threads have exited even if // offerservice thread died abnormally shutdown(); }
/** * Stop the datanode. */ public void stopDataNode(DataNode dn) { if (dn != null) { dn.shutdown(); } }
public synchronized DataNodeProperties stopDataNode(int i) { if (i < 0 || i >= dataNodes.size()) { return null; } DataNodeProperties dnprop = dataNodes.remove(i); DataNode dn = dnprop.datanode; System.out.println("MiniDFSCluster Stopping DataNode " + dn.dnRegistration.getName() + " from a total of " + (dataNodes.size() + 1) + " datanodes."); dn.shutdown(); numDataNodes--; return dnprop; }
/** * Create the DataNode given a configuration and an array of dataDirs. * 'dataDirs' is where the blocks are stored. */ DataNode(Configuration conf, AbstractList<File> dataDirs) throws IOException { super(conf); datanodeObject = this; try { startDataNode(conf, dataDirs); } catch (IOException ie) { shutdown(); throw ie; } }
/** * Check whether the datanode can be started. */ private boolean canStartDataNode(Configuration conf) throws IOException { DataNode dn = null; try { dn = DataNode.createDataNode(new String[]{}, conf); } catch(IOException e) { if (e instanceof java.net.BindException) return false; throw e; } finally { if(dn != null) dn.shutdown(); } return true; }
/** * Shutdown all DataNodes started by this class. The NameNode * is left running so that new DataNodes may be started. */ public void shutdownDataNodes() { for (int i = dataNodes.size()-1; i >= 0; i--) { LOG.info("Shutting down DataNode " + i); DataNode dn = dataNodes.remove(i).datanode; dn.shutdown(); numDataNodes--; } }
/** * Cleans the resources and closes the instance of datanode * @throws IOException if an error occurred */ @After public void tearDown() throws IOException { if (dn != null) { try { dn.shutdown(); } catch(Exception e) { LOG.error("Cannot close: ", e); } finally { File dir = new File(DATA_DIR); if (dir.exists()) Assert.assertTrue( "Cannot delete data-node dirs", FileUtil.fullyDelete(dir)); } } }
public synchronized DataNodeProperties stopDataNode(int i) { if (i < 0 || i >= dataNodes.size()) { return null; } DataNodeProperties dnprop = dataNodes.remove(i); DataNode dn = dnprop.datanode; LOG.info("MiniDFSCluster Stopping DataNode " + dn.getDisplayName() + " from a total of " + (dataNodes.size() + 1) + " datanodes."); dn.shutdown(); numDataNodes--; return dnprop; }
/** * Check whether the datanode can be started. */ private boolean canStartDataNode(Configuration conf) throws IOException { DataNode dn = null; try { dn = DataNode.createDataNode(new String[]{}, conf); } catch(IOException e) { if (e instanceof java.net.BindException) return false; throw e; } finally { if(dn != null) dn.shutdown(); } return true; }
@Test public void testSendOOBToPeers() throws Exception { DataNode dn = cluster.getDataNodes().get(0); DataXceiverServer spyXserver = Mockito.spy(dn.getXferServer()); NullPointerException e = new NullPointerException(); Mockito.doThrow(e).when(spyXserver).sendOOBToPeers(); dn.xserver = spyXserver; try { dn.shutdown(); } catch (Throwable t) { fail("DataNode shutdown should not have thrown exception " + t); } } }
/** * Cleans the resources and closes the instance of datanode * @throws IOException if an error occurred */ @After public void tearDown() throws IOException { if (dn != null) { try { dn.shutdown(); } catch(Exception e) { LOG.error("Cannot close: ", e); } finally { File dir = new File(DATA_DIR); if (dir.exists()) Assert.assertTrue( "Cannot delete data-node dirs", FileUtil.fullyDelete(dir)); } } }