code: public void shutdown() {
  
  		if (!this.shutdownStarted.compareAndSet(false, true)) {
  			return;
  		}
  
  		LOG.info("Shutting down TaskManager");
  		
  		// first, stop the heartbeat thread and wait for it to terminate
  		this.heartbeatThread.interrupt();
  		try {
  			this.heartbeatThread.join(1000);
  		} catch (InterruptedException e) {}
  
  		// Stop RPC proxy for the task manager
  		RPC.stopProxy(this.jobManager);
  
  		// Stop RPC proxy for the global input split assigner
  		RPC.stopProxy(this.globalInputSplitProvider);
  
  		// Stop RPC proxy for the lookup service
  		RPC.stopProxy(this.lookupService);
  
  		// Stop RPC proxy for accumulator reports
  		RPC.stopProxy(this.accumulatorProtocolProxy);
  
  		// Shut down the own RPC server
  		this.taskManagerServer.stop();
  
  		// Stop profiling if enabled
  		if (this.profiler != null) {
  			this.profiler.shutdown();
  		}
  
  		// Shut down the network channel manager
  		this.channelManager.shutdown();
  
  		// Shut down the memory manager
  		if (this.ioManager != null) {
  			this.ioManager.shutdown();
  		}
  
  		if (this.memoryManager != null) {
  			this.memoryManager.shutdown();
  		}
  
  		this.fileCache.shutdown();
  
  		// Shut down the executor service
  		if (this.executorService != null) {
  			this.executorService.shutdown();
  			try {
  				this.executorService.awaitTermination(5000L, TimeUnit.MILLISECONDS);
  			} catch (InterruptedException e) {
  				if (LOG.isDebugEnabled()) {
  					LOG.debug(e);
  				}
  			}
  		}
  
  		this.shutdownComplete = true;
  	}
docs: Shuts the task manager down.