diff --git a/api/src/main/java/io/grpc/Server.java b/api/src/main/java/io/grpc/Server.java index 781455b18e..31e0a6478e 100644 --- a/api/src/main/java/io/grpc/Server.java +++ b/api/src/main/java/io/grpc/Server.java @@ -43,7 +43,7 @@ public abstract class Server { * listening socket(s). * * @return {@code this} object - * @throws IllegalStateException if already started + * @throws IllegalStateException if already started or shut down * @throws IOException if unable to bind * @since 1.0.0 */ @@ -119,6 +119,9 @@ public abstract class Server { * {@link #awaitTermination()} or {@link #awaitTermination(long, TimeUnit)} needs to be called to * wait for existing calls to finish. * + *

Calling this method before {@code start()} will shut down and terminate the server like + * normal, but prevents starting the server in the future. + * * @return {@code this} object * @since 1.0.0 */ @@ -130,6 +133,9 @@ public abstract class Server { * return {@code false} immediately after this method returns. After this call returns, this * server has released the listening socket(s) and may be reused by another server. * + *

Calling this method before {@code start()} will shut down and terminate the server like + * normal, but prevents starting the server in the future. + * * @return {@code this} object * @since 1.0.0 */ @@ -157,6 +163,9 @@ public abstract class Server { /** * Waits for the server to become terminated, giving up if the timeout is reached. * + *

Calling this method before {@code start()} or {@code shutdown()} is permitted and does not + * change its behavior. + * * @return whether the server is terminated, as would be done by {@link #isTerminated()}. */ public abstract boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException; @@ -164,6 +173,9 @@ public abstract class Server { /** * Waits for the server to become terminated. * + *

Calling this method before {@code start()} or {@code shutdown()} is permitted and does not + * change its behavior. + * * @since 1.0.0 */ public abstract void awaitTermination() throws InterruptedException;