Stop the endpoint. This will cause all processing threads to stop.
()
| 192 | * Stop the endpoint. This will cause all processing threads to stop. |
| 193 | */ |
| 194 | @Override |
| 195 | public void stopInternal() { |
| 196 | if (!paused) { |
| 197 | pause(); |
| 198 | } |
| 199 | if (running) { |
| 200 | running = false; |
| 201 | acceptor.stopMillis(10); |
| 202 | // Use the executor to avoid binding the main thread if something bad |
| 203 | // occurs and unbind will also wait for a bit for it to complete |
| 204 | getExecutor().execute(() -> { |
| 205 | // Then close all active connections if any remain |
| 206 | try { |
| 207 | for (SocketWrapperBase<Nio2Channel> wrapper : getConnections()) { |
| 208 | wrapper.close(); |
| 209 | } |
| 210 | } catch (Throwable t) { |
| 211 | ExceptionUtils.handleThrowable(t); |
| 212 | } finally { |
| 213 | allClosed = true; |
| 214 | } |
| 215 | }); |
| 216 | if (nioChannels != null) { |
| 217 | Nio2Channel socket; |
| 218 | while ((socket = nioChannels.pop()) != null) { |
| 219 | socket.free(); |
| 220 | } |
| 221 | nioChannels = null; |
| 222 | } |
| 223 | if (processorCache != null) { |
| 224 | processorCache.clear(); |
| 225 | processorCache = null; |
| 226 | } |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | |
| 231 | /** |
nothing calls this directly
no test coverage detected