@Override public void onApplicationEvent(ContextClosedEvent event) { if (connector != null) { this.connector.pause(); Executor executor = this.connector.getProtocolHandler().getExecutor(); if (executor instanceof ThreadPoolExecutor) { try { ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) executor; threadPoolExecutor.shutdown(); if (!threadPoolExecutor.awaitTermination(30, TimeUnit.SECONDS)) { log.warn("Tomcat thread pool did not shut down gracefully within " + "30 seconds. Proceeding with forceful shutdown"); } } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } } } }
/** * Perform a pause on the server. * @throw InterruptedException if we have an interruption */ public void pause() { // Used to properly handle the work queue. final Executor executor = connector.getProtocolHandler().getExecutor(); // Start the pause. connector.pause(); }
@Override public void onApplicationEvent(ContextClosedEvent event) { this.connector.pause(); log.info("Shutting Down LivingDoc Remote Agent"); Executor executor = this.connector.getProtocolHandler().getExecutor(); if (executor instanceof ThreadPoolExecutor) { try { ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) executor; threadPoolExecutor.shutdown(); if (!threadPoolExecutor.awaitTermination(30, TimeUnit.SECONDS)) { log.warn("Tomcat thread pool did not shut down gracefully within " + "30 seconds. Proceeding with forceful shutdown"); } } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } } }
public synchronized void stopConnectors() throws Exception { if (tomcatDeployer == null) throw new IllegalStateException("Must set TomcatDeployer before stopping connectors"); if (!connectorsRunning) return; // Notify listeners that connectors have started processing requests sendNotification(new Notification(TOMCAT_CONNECTORS_STOPPED, this, getNextNotificationSequenceNumber())); MBeanServer server = super.getServer(); ObjectName service = new ObjectName(tomcatDeployer.getDomain() + ":type=Service,serviceName=jboss.web"); Object[] args = {}; String[] sig = {}; Connector[] connectors = (Connector[]) server.invoke(service, "findConnectors", args, sig); for (int n = 0; n < connectors.length; n++) { connectors[n].pause(); connectors[n].stop(); } connectorsRunning = false; }
connectors[i].pause();
synchronized (connectors) { for (int i = 0; i < connectors.length; i++) { connectors[i].pause();
synchronized (connectors) { for (int i = 0; i < connectors.length; i++) { connectors[i].pause();
for (Connector connector: connectors) { try { connector.pause(); } catch (Exception e) { log.error(sm.getString(
for (Connector connector: connectors) { try { connector.pause(); } catch (Exception e) { log.error(sm.getString(
connector.pause();
for (Connector connector: connectors) { try { connector.pause(); } catch (Exception e) { log.error(sm.getString(
for (Connector connector: connectors) { try { connector.pause(); } catch (Exception e) { log.error(sm.getString(
for (Connector connector: connectors) { try { connector.pause(); } catch (Exception e) { log.error(sm.getString(
for (Connector connector: connectors) { try { connector.pause(); } catch (Exception e) { log.error(sm.getString(