Stops the thread that reads data from the input stream.
Note that the input stream is not closed.

@param event the event
@throws InterruptedException the interrupted exception
778650
@Handler(priority = -10000)
    public void onStop(Stop event) throws InterruptedException {
        synchronized (this) {
            if (runner == null) {
                return;
            }
            runner.interrupt();
            synchronized (this) {
                if (registered) {
                    unregisterAsGenerator();
                    registered = false;
                }
            }
            runner = null;
        }
    }
278072
def stop(self):
        '''
        
        '''
        self._stop_event.set()
        if self._func_stop_event is not None:
            self._func_stop_event.set()
        self.join(timeout=1)
        if self.isAlive():
            print('Failed to stop thread')
711621
@NullSafe
  public static void interrupt(Thread thread) {
    Optional.ofNullable(thread).ifPresent(Thread::interrupt);
  }
535710
public void terminate() throws InterruptedException, IOException {
        final Computer computer = toComputer();
        if (computer != null) {
            computer.recordTermination();
        }
        try {
            // TODO: send the output to somewhere real
            _terminate(new StreamTaskListener(System.out, Charset.defaultCharset()));
        } finally {
            try {
                Jenkins.get().removeNode(this);
            } catch (IOException e) {
                LOGGER.log(Level.WARNING, "Failed to remove "+name,e);
            }
        }
    }
600787
public synchronized final void stop()
    	throws InterruptedException
    {
        if (!_started || _stopping)
            return;
        _stopping=true;

        if (log.isDebugEnabled()) log.debug("Stopping "+this);
        LifeCycleEvent event = new LifeCycleEvent(this);
        for(int i=0;i<LazyList.size(_eventListeners);i++)
        {
            EventListener listener=(EventListener)LazyList.get(_eventListeners,i);
            if (listener instanceof LifeCycleListener)
                ((LifeCycleListener)listener).lifeCycleStopping(event);
        }
        
        try
        {	
            doStop();
            _started=false;
            log.info("Stopped "+this);
            for(int i=0;i<LazyList.size(_eventListeners);i++)
            {
                EventListener listener=(EventListener)LazyList.get(_eventListeners,i);
                if (listener instanceof LifeCycleListener)
                    ((LifeCycleListener)listener).lifeCycleStopped(event);
            }
        }
        catch(Throwable e)
        {
            event = new LifeCycleEvent(this,e);
            for(int i=0;i<LazyList.size(_eventListeners);i++)
            {
                EventListener listener=(EventListener)LazyList.get(_eventListeners,i);
                if (listener instanceof LifeCycleListener)
                    ((LifeCycleListener)listener).lifeCycleFailure(event);
            }
            if (e instanceof InterruptedException)
                throw (InterruptedException)e;
            if (e instanceof RuntimeException)
                throw (RuntimeException)e;
            if (e instanceof Error)
                throw (Error)e;
            log.warn(LogSupport.EXCEPTION, e);
        }
        finally
        {
            _stopping=false;
        }
    }
439709
public void close() throws InterruptedException {
        if (reader_instance != null) {
            reader_instance.closeFiles();
        }
        reader_instance = null;

        // you can only close a syncmanager, when drums was opened for READ_WRITE
        if (syncManager != null) {
            syncManager.shutdown();
            syncManager.join();
        }
    }
219494
@Handler
    @SuppressWarnings("PMD.DataflowAnomalyAnalysis")
    public void onClose(Close event) throws IOException, InterruptedException {
        boolean subOnly = true;
        for (Channel channel : event.channels()) {
            if (channel instanceof TcpChannelImpl) {
                if (channels.contains(channel)) {
                    ((TcpChannelImpl) channel).close();
                }
            } else {
                subOnly = false;
            }
        }
        if (subOnly || !serverSocketChannel.isOpen()) {
            // Closed already
            fire(new Closed());
            return;
        }
        synchronized (channels) {
            closing = true;
            // Copy to avoid concurrent modification exception
            Set<TcpChannelImpl> conns = new HashSet<>(channels);
            for (TcpChannelImpl conn : conns) {
                conn.close();
            }
            while (!channels.isEmpty()) {
                channels.wait();
            }
        }
        serverSocketChannel.close();
        purger.interrupt();
        closing = false;
        fire(new Closed());
    }
514270
public void shutdownBlocking() throws InterruptedException
    {
        executor.shutdown();
        executor.awaitTermination();
        allocator.shutdown();
        allocator.awaitTermination();
    }
1368605
@Handler(priority = -10000)
    public void onStop(Stop event) throws InterruptedException {
        synchronized (this) {
            if (runner == null) {
                return;
            }
            // It just might happen that the wakeup() occurs between the
            // check for running and the select() in the thread's run loop,
            // but we -- obviously -- cannot put the select() in a
            // synchronized(this).
            while (runner.isAlive()) {
                runner.interrupt(); // *Should* be sufficient, but...
                selector.wakeup(); // Make sure
                runner.join(10);
            }
            runner = null;
        }
    }
167057
public void stop() throws InterruptedException
    {
        synchronized (this)
        {
            // Signal that we are stopping
            _running = false;

            // Close the listener socket.
            if (log.isDebugEnabled()) log.debug("closing " + _listen);
            try
            {
                if (_listen != null) _listen.close();
                _listen=null;
            }
            catch (IOException e)
            {
                log.warn(LogSupport.EXCEPTION, e);
            }

            // Do we have an acceptor thread (running or not)
            Thread.yield();
            for (int a = 0; _acceptor!=null && a<_acceptor.length; a++)
            {
                Acceptor acc = _acceptor[a];
                if (acc != null) 
                    acc.interrupt();
            }
            Thread.sleep(100);

            for (int a = 0; _acceptor!=null && a<_acceptor.length; a++)
            {
                Acceptor acc = _acceptor[a];

                if (acc != null)
                {
                    acc.forceStop();
                    _acceptor[a] = null;
                }
            }
        }

        // Stop the thread pool
        try
        {
            super.stop();
        }
        catch (Exception e)
        {
            log.warn(LogSupport.EXCEPTION, e);
        }
        finally
        {
            synchronized (this)
            {
                _acceptor = null;
            }
        }
    }
358880
@Handler
    @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
    public void onSaveInput(SaveInput event) throws InterruptedException {
        if (!Arrays.asList(event.options())
            .contains(StandardOpenOption.WRITE)) {
            throw new IllegalArgumentException(
                "File must be opened for writing.");
        }
        for (IOSubchannel channel : event.channels(IOSubchannel.class)) {
            if (inputWriters.containsKey(channel)) {
                channel.respond(new IOError(event,
                    new IllegalStateException("File is already open.")));
            } else {
                new Writer(event, channel);
            }
        }
    }
168321
@Override
	public void stopped() {

		// Mark as stopped
		started.set(false);

		// Stop timers
		super.stopped();

		// Disconnect
		try {
			Thread.sleep(100);
		} catch (InterruptedException interrupt) {
		}
		disconnect();
	}
1299380
protected void shutdown() throws InterruptedException {
        if (m_deadConnectionFuture != null) {
            m_deadConnectionFuture.cancel(false);
            try {m_deadConnectionFuture.get();} catch (Throwable t) {}
        }
        if (m_topologyCheckFuture != null) {
            m_topologyCheckFuture.cancel(false);
            try {m_topologyCheckFuture.get();} catch (Throwable t) {}
        }
        if (m_maxConnectionUpdater != null) {
            m_maxConnectionUpdater.cancel(false);
        }
        if (m_acceptor != null) {
            m_acceptor.shutdown();
        }
        if (m_adminAcceptor != null)
        {
            m_adminAcceptor.shutdown();
        }
        if (m_snapshotDaemon != null) {
            m_snapshotDaemon.shutdown();
        }

        if (m_migratePartitionLeaderExecutor != null) {
            m_migratePartitionLeaderExecutor.shutdown();
        }
        m_notifier.shutdown();
    }
604154
public void close() throws InterruptedException {
    synchronized (this) {
      Pools.remove(this);
      poolState.set(POOL_STATE_CLOSING);
      pendingRequestNumber.set(0);

      scheduledFuture.cancel(false);
      connectionAppender.shutdown();

      try {
        connectionAppender.awaitTermination(10, TimeUnit.SECONDS);
      } catch (InterruptedException i) {
        //eat
      }

      if (logger.isInfoEnabled()) {
        logger.info("closing pool {} (total:{}, active:{}, pending:{})",
            poolTag, totalConnection.get(), getActiveConnections(), pendingRequestNumber.get());
      }

      ExecutorService connectionRemover = new ThreadPoolExecutor(totalConnection.get(),
          options.maxPoolSize, 10, TimeUnit.SECONDS,
          new LinkedBlockingQueue<>(options.maxPoolSize),
          new MariaDbThreadFactory(poolTag + "-destroyer"));

      //loop for up to 10 seconds to close not used connection
      long start = System.nanoTime();
      do {
        closeAll(connectionRemover, idleConnections);
        if (totalConnection.get() > 0) {
          Thread.sleep(0, 10_00);
        }
      } while (totalConnection.get() > 0
          && TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - start) < 10);

      //after having wait for 10 seconds, force removal, even if used connections
      if (totalConnection.get() > 0 || idleConnections.isEmpty()) {
        closeAll(connectionRemover, idleConnections);
      }

      connectionRemover.shutdown();
      try {
        unRegisterJmx();
      } catch (Exception exception) {
        //eat
      }
      connectionRemover.awaitTermination(10, TimeUnit.SECONDS);
    }
  }
61711
protected void interruptThread() {
        Thread currentThread = thread;
        if (currentThread == null) {
            interrupted = true;
        } else {
            currentThread.interrupt();
        }
    }
835724
private void lock() throws IOException {
		try {
			lock.lockInterruptibly();
		}
		catch (InterruptedException e) {
			Thread.currentThread().interrupt();
			throw new IOException("interrupted");
		}
	}
780584
public synchronized void stop() {
		running = false;
		pool.shutdown();
		try {
			if (!pool.awaitTermination(60, TimeUnit.SECONDS))
				pool.shutdownNow();
			if (!serverSocket.isClosed())
				this.serverSocket.close();
		} catch (IOException e) {
			DBP.printerror("Error closing Socket.");
			DBP.printException(e);
		} catch (InterruptedException ie) {
			DBP.printerror("Error shutting down threadpool.");
			DBP.printException(ie);
			// (Re-)Cancel if current thread also interrupted
			pool.shutdownNow();
			// Preserve interrupt status
			Thread.currentThread().interrupt();
		}
	}