MCPcopy Create free account
hub / github.com/grpc/grpc-java / shutdownNow

Method shutdownNow

core/src/main/java/io/grpc/internal/ServerImpl.java:273–299  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 3

shutdownMethod · 0.95
withDescriptionMethod · 0.80
shutdownNowMethod · 0.65

Tested by

no test coverage detected