private void scheduleClose() { closeWaitTask = connectionCloseScheduler.schedule(() -> { synchronized (TransportFilter.class) { if (closeWaitTask == null) { return; } channelGroup.shutdown(); channelGroup = null; closeWaitTask = null; } }, currentContainerIdleTimeout, TimeUnit.MILLISECONDS); }
private void updateThreadPoolConfig() { // the channel group is active, no change in configuration if (openedConnections.get() != 0) { return; } // check if the new configuration is different from the one of the current container if (!threadPoolConfig.equals(currentThreadPoolConfig) || containerIdleTimeout != currentContainerIdleTimeout) { currentThreadPoolConfig = threadPoolConfig; currentContainerIdleTimeout = containerIdleTimeout; if (channelGroup == null) { // the channel group has not been initialized (this is a first client) - no need to shut it down return; } closeWaitTask.cancel(true); closeWaitTask = null; channelGroup.shutdown(); channelGroup = null; } }
@Override public void shutdown() { group.shutdown(); }
public static void unregister() { synchronized (lock) { usageCount--; if (usageCount == 0) { group.shutdown(); group = null; } } }
public static void unregister() { synchronized (lock) { usageCount--; if (usageCount == 0) { group.shutdown(); group = null; } } }
@Override public void run() { synchronized (TransportFilter.class) { if (closeWaitTask == null) { return; } channelGroup.shutdown(); channelGroup = null; closeWaitTask = null; } } }, currentContainerIdleTimeout, TimeUnit.SECONDS);
public static void unregister() { synchronized (lock) { usageCount--; if (usageCount == 0) { group.shutdown(); group = null; } } }
public static void unregister() { synchronized (lock) { usageCount--; if (usageCount == 0) { group.shutdown(); group = null; } } }
@Override protected void doEnd() throws IOException, InterruptedException { serverSocket.close(); channelGroup.shutdown(); }
@Override protected void doEnd() throws IOException, InterruptedException { serverSocket.close(); channelGroup.shutdown(); }
/** * Closes all ports and shuts down the NioReactor service */ public synchronized void shutdown() { this.closePorts(); asyncChannelGroup.shutdown(); }
/** * 停止客户端服务. * <p> * 调用该方法会触发AioSession的close方法,并且如果当前客户端若是通过执行{@link AioQuickClient#start()}方法构建的,同时会触发asynchronousChannelGroup的shutdown动作。 * </p> */ public final void shutdown() { if (session != null) { session.close(); session = null; } //仅Client内部创建的ChannelGroup需要shutdown if (asynchronousChannelGroup != null) { asynchronousChannelGroup.shutdown(); } }
private void updateThreadPoolConfig() { // the channel group is active, no change in configuration if (openedConnections.get() != 0) { return; } Integer closeWait = containerIdleTimeout == null ? DEFAULT_CONNECTION_CLOSE_WAIT : containerIdleTimeout; // check if the new configuration is different from the one of the current container if (!threadPoolConfig.equals(currentThreadPoolConfig) || !closeWait.equals(currentContainerIdleTimeout)) { currentThreadPoolConfig = threadPoolConfig; currentContainerIdleTimeout = closeWait; if (channelGroup == null) { // the channel group has not been initialized (this is a first client) - no need to shut it down return; } closeWaitTask.cancel(true); closeWaitTask = null; channelGroup.shutdown(); channelGroup = null; } }
private void closeChannel(){ acceptHandler.stopService(); try { this.serverChannel.close(); } catch (IOException e) { e.printStackTrace(); } this.channelGroup.shutdown(); }
@Override protected void destroy() { if (group != null) { try { group.shutdown(); } catch (Exception e) { log.error("aio tcp thread group shutdown exception -> {}", e.getMessage()); } } if (config.isMonitorEnable()) { try { reporter.stop(); } catch (Exception e) { log.error("stop metric reporter exception -> {}", e.getMessage()); } } } }
@Override protected void destroy() { if (group != null) { try { group.shutdown(); } catch (Exception e) { log.error("aio tcp thread group shutdown exception -> {}", e.getMessage()); } } if (config.isMonitorEnable()) { try { reporter.stop(); } catch (Exception e) { log.error("stop metric reporter exception -> {}", e.getMessage()); } } } }
@Override public void shutdown() { if(group != null) { group.shutdown(); } LogFactory.getInstance().shutdown(); Millisecond100Clock.stop(); }
@Override public void shutdown() { if(group != null) { group.shutdown(); } LogFactory.getInstance().shutdown(); Millisecond100Clock.stop(); }