()
| 271 | } |
| 272 | |
| 273 | @Override |
| 274 | public ServerImpl shutdownNow() { |
| 275 | shutdown(); |
| 276 | Collection<ServerTransport> transportsCopy; |
| 277 | Status nowStatus = Status.UNAVAILABLE.withDescription("Server shutdownNow invoked"); |
| 278 | boolean savedServerShutdownCallbackInvoked; |
| 279 | synchronized (lock) { |
| 280 | // Short-circuiting not strictly necessary, but prevents transports from needing to handle |
| 281 | // multiple shutdownNow invocations if shutdownNow is called multiple times. |
| 282 | if (shutdownNowStatus != null) { |
| 283 | return this; |
| 284 | } |
| 285 | shutdownNowStatus = nowStatus; |
| 286 | transportsCopy = new ArrayList<>(transports); |
| 287 | savedServerShutdownCallbackInvoked = serverShutdownCallbackInvoked; |
| 288 | } |
| 289 | // Short-circuiting not strictly necessary, but prevents transports from needing to handle |
| 290 | // multiple shutdownNow invocations, between here and the serverShutdown callback. |
| 291 | if (savedServerShutdownCallbackInvoked) { |
| 292 | // Have to call shutdownNow, because serverShutdown callback only called shutdown, not |
| 293 | // shutdownNow |
| 294 | for (ServerTransport transport : transportsCopy) { |
| 295 | transport.shutdownNow(nowStatus); |
| 296 | } |
| 297 | } |
| 298 | return this; |
| 299 | } |
| 300 | |
| 301 | @Override |
| 302 | public boolean isShutdown() { |
nothing calls this directly
no test coverage detected