Cluster shutdown itself by sending a shutdown UDP packet.
772662
public static void shutdown(int status) {
    if(status == 0) H2O.orderlyShutdown();
    UDPRebooted.T.error.send(H2O.SELF);
    H2O.exit(status);
  }
1289364
def close(self) -> None:
        
        def _shutdown() -> None:
            self.transport.close()
            self.shutdown_event.set()

        with self._shutdown_lock:
            if not self._shutdown:
                self._shutdown = True
                self.protocol.loop.call_soon_threadsafe(_shutdown)
756010
def Shutdown(self):
        """"""
        logger.debug("Nodeleader shutting down")

        self.stop_peer_check_loop()
        self.peer_check_loop_deferred = None

        self.stop_check_bcr_loop()
        self.check_bcr_loop_deferred = None

        self.stop_memcheck_loop()
        self.memcheck_loop_deferred = None

        self.stop_blockheight_loop()
        self.blockheight_loop_deferred = None

        for p in self.Peers:
            p.Disconnect()
424792
def shutdown(self):
        """"""
        if self.ZMQcontext and not self.ZMQcontext.closed:
            scoop.SHUTDOWN_REQUESTED = True
            self.socket.send(SHUTDOWN)
            
            # pyzmq would issue an 'no module named zmqerror' on windows
            # without this
            try:
                self.direct_socket.__del__()
                self.socket.__del__()
                self.infoSocket.__del__()
            except AttributeError:
                # Older versions of pyzmq doesn't have the __del__ method
                pass

            self.ZMQcontext.destroy()
1147902
def close(self):
        """"""

        try:
            self.sock.shutdown(socket.SHUT_RDWR)
            self.sock.close()
        except socket.error:
            pass
470934
public void shutdown() {
    LOGGER.info("Responder shutting down: [" + _runtimeId + "]");
    for (Transport t : _transports) {
      try {
        t.shutdown();
      } catch (TransportException e) {
        LOGGER.warn( "Error shutting down transport: [" + t.transportName() + "]", e);
      }
    }
  }
691168
public final void shutdown() throws IOException {
    if (this.shutdown) {
      return;
    }
    this.shutdown0();
    this.shutdown = true;
    this.connector.shuttingDown();
    this.connector.quitAllSessions();
    this.connector.stop();
    this.memcachedHandler.stop();
    XMemcachedMbeanServer.getInstance().shutdown();
    if (AddrUtil.isEnableShutDownHook() && !this.isHutdownHookCalled) {
      try {
        Runtime.getRuntime().removeShutdownHook(this.shutdownHookThread);
      } catch (Exception e) {
        // ignore;
      }
    }
  }
251141
def shutdown_request(self, request):
        """"""
        try:
            # explicitly shutdown.  socket.close() merely releases
            # the socket and waits for GC to perform the actual close.
            request.shutdown(socket.SHUT_RDWR)

        except:
            pass  # some platforms may raise ENOTCONN here
        self.close_request(request)
1053293
public void shutdown() {
	accept = false;
	try {
	    _server.close();
	} catch(Exception e) {}
	// this is a hack to ensue the server socket is
	// unblocked from accpet()
	// but this is not guaranteed to work still
        SocketFactory factory = SocketFactory.getDefault();
	Socket s = null;
	try {
	    s = factory.createSocket(InetAddress.getLocalHost(), getPort());
	    s.getInputStream();
	} catch (Exception e) {
	    // can be ignored
	} finally {
	    if (s != null) {
		try { s.close(); } catch (Exception e) {}
	    }
	}

	// reset everything
        serverThread = null;
        _server = null;
    }
247821
public synchronized static void shutdown() {
        Set<String> protocols = instances.keySet();

        if (protocols.size() > 0) {
            Iterator<String> i = protocols.iterator();

            SyslogUtility.sleep(SyslogConstants.THREAD_LOOP_INTERVAL_DEFAULT);

            while(i.hasNext()) {
                String protocol = i.next();

                SyslogIF syslog = instances.get(protocol);

                syslog.shutdown();
            }

            instances.clear();
        }
    }
436290
def stop(self):
        
        self.debug("()")
        super(SensorServer, self).stop()
        # No new clients
        if self._multicast_socket is not None:
            self._shutdown_multicast_socket()
        # Signal packet loop to shutdown
        self._is_stopped.set()
85256
def shutdown(self):
        """"""
        if self.OPEN:
            self.OPEN = False
            scoop.SHUTDOWN_REQUESTED = True
            self.socket.send(b"SHUTDOWN")
            self.socket.close()
            self.infoSocket.close()
            time.sleep(0.3)
1253640
@Override
    public synchronized void shutdown()
    {
        // prevent reentrant invocation
        if(isShutdown())
            return;

        // create a temporary set of providers to shutdown after completing all the pin instance shutdowns
        Set<GpioProvider> gpioProvidersToShutdown = new HashSet<>();

        // shutdown explicit configured GPIO pins
        for (GpioPin pin : pins) {

            // add each GPIO provider to the shutdown set
            if(!gpioProvidersToShutdown.contains(pin.getProvider())){
                gpioProvidersToShutdown.add(pin.getProvider());
            }

            // perform the shutdown options if configured for the pin
            GpioPinShutdown shutdownOptions = pin.getShutdownOptions();
            if (shutdownOptions != null) {
                // get shutdown option configuration
                PinState state = shutdownOptions.getState();
                PinMode mode = shutdownOptions.getMode();
                PinPullResistance resistance = shutdownOptions.getPullResistor();
                Boolean unexport = shutdownOptions.getUnexport();

                // perform shutdown actions
                if ((state != null) && pin.isMode(PinMode.DIGITAL_OUTPUT)) {
                    ((GpioPinDigitalOutput)pin).setState(state);
                }
                if (resistance != null) {
                    pin.setPullResistance(resistance);
                }
                if (mode != null) {
                    pin.setMode(mode);
                }
                if (unexport != null && unexport == Boolean.TRUE) {
                    pin.unexport();
                }
            }
        }

        // perform a shutdown on each GPIO provider
        for(GpioProvider gpioProvider : gpioProvidersToShutdown){
            if(!gpioProvider.isShutdown()){
                gpioProvider.shutdown();
            }
        }

        // shutdown all executor services
        //
        // NOTE: we are not permitted to access the shutdown() method of the individual
        // executor services, we must perform the shutdown with the factory
        GpioFactory.getExecutorServiceFactory().shutdown();

        // set is shutdown tracking variable
        isshutdown = true;
    }
2474
private void shutdown(final Map<String, Object> respMap) {
    try {
      logger.warn("Shutting down executor...");

      // Set the executor to inactive. Will receive no new flows.
      setActiveInternal(false);
      this.application.shutdown();
      respMap.put(ConnectorParams.STATUS_PARAM, ConnectorParams.RESPONSE_SUCCESS);
    } catch (final Exception e) {
      logger.error(e.getMessage(), e);
      respMap.put(ConnectorParams.RESPONSE_ERROR, e.getMessage());
    }
  }
202799
public void shutdown() {
    gossipServiceRunning.set(false);
    gossipThreadExecutor.shutdown();
    if (passiveGossipThread != null) {
      passiveGossipThread.shutdown();
    }
    if (activeGossipThread != null) {
      activeGossipThread.shutdown();
    }
    try {
      boolean result = gossipThreadExecutor.awaitTermination(1000, TimeUnit.MILLISECONDS);
      if (!result) {
        LOGGER.error("executor shutdown timed out");
      }
    } catch (InterruptedException e) {
      LOGGER.error(e);
    }
  }
590158
def _shutdown_transport(self):
        """"""
        if self.sock is not None:
            try:
                unwrap = self.sock.unwrap
            except AttributeError:
                return
            try:
                self.sock = unwrap()
            except ValueError:
                # Failure within SSL might mean unwrap exists but socket is not
                # deemed wrapped
                pass
375344
def teardown_socket(s):
  """"""
  try:
    s.shutdown(socket.SHUT_WR)
  except socket.error:
    pass
  finally:
    s.close()