core: add Since java doc annotations to Server, and clarify return types

This commit is contained in:
Carl Mastrangelo 2017-05-11 10:10:01 -07:00 committed by GitHub
parent 9954c5fe90
commit 90559c7f0a
1 changed files with 18 additions and 0 deletions

View File

@ -49,6 +49,7 @@ public abstract class Server {
* @return {@code this} object * @return {@code this} object
* @throws IllegalStateException if already started * @throws IllegalStateException if already started
* @throws IOException if unable to bind * @throws IOException if unable to bind
* @since 1.0.0
*/ */
public abstract Server start() throws IOException; public abstract Server start() throws IOException;
@ -58,6 +59,7 @@ public abstract class Server {
* terminated. * terminated.
* *
* @throws IllegalStateException if the server has not yet been started. * @throws IllegalStateException if the server has not yet been started.
* @since 1.0.0
*/ */
public int getPort() { public int getPort() {
return -1; return -1;
@ -66,6 +68,8 @@ public abstract class Server {
/** /**
* Returns all services registered with the server, or an empty list if not supported by the * Returns all services registered with the server, or an empty list if not supported by the
* implementation. * implementation.
*
* @since 1.1.0
*/ */
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2222") @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2222")
public List<ServerServiceDefinition> getServices() { public List<ServerServiceDefinition> getServices() {
@ -75,6 +79,8 @@ public abstract class Server {
/** /**
* Returns immutable services registered with the server, or an empty list if not supported by the * Returns immutable services registered with the server, or an empty list if not supported by the
* implementation. * implementation.
*
* @since 1.1.0
*/ */
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2222") @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2222")
public List<ServerServiceDefinition> getImmutableServices() { public List<ServerServiceDefinition> getImmutableServices() {
@ -85,6 +91,8 @@ public abstract class Server {
/** /**
* Returns mutable services registered with the server, or an empty list if not supported by the * Returns mutable services registered with the server, or an empty list if not supported by the
* implementation. * implementation.
*
* @since 1.1.0
*/ */
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2222") @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2222")
public List<ServerServiceDefinition> getMutableServices() { public List<ServerServiceDefinition> getMutableServices() {
@ -93,6 +101,9 @@ public abstract class Server {
/** /**
* Initiates an orderly shutdown in which preexisting calls continue but new calls are rejected. * Initiates an orderly shutdown in which preexisting calls continue but new calls are rejected.
*
* @return {@code this} object
* @since 1.0.0
*/ */
public abstract Server shutdown(); public abstract Server shutdown();
@ -100,6 +111,9 @@ public abstract class Server {
* Initiates a forceful shutdown in which preexisting and new calls are rejected. Although * Initiates a forceful shutdown in which preexisting and new calls are rejected. Although
* forceful, the shutdown process is still not instantaneous; {@link #isTerminated()} will likely * forceful, the shutdown process is still not instantaneous; {@link #isTerminated()} will likely
* return {@code false} immediately after this method returns. * return {@code false} immediately after this method returns.
*
* @return {@code this} object
* @since 1.0.0
*/ */
public abstract Server shutdownNow(); public abstract Server shutdownNow();
@ -109,6 +123,7 @@ public abstract class Server {
* *
* @see #shutdown() * @see #shutdown()
* @see #isTerminated() * @see #isTerminated()
* @since 1.0.0
*/ */
public abstract boolean isShutdown(); public abstract boolean isShutdown();
@ -117,6 +132,7 @@ public abstract class Server {
* relevant resources released (like TCP connections). * relevant resources released (like TCP connections).
* *
* @see #isShutdown() * @see #isShutdown()
* @since 1.0.0
*/ */
public abstract boolean isTerminated(); public abstract boolean isTerminated();
@ -129,6 +145,8 @@ public abstract class Server {
/** /**
* Waits for the server to become terminated. * Waits for the server to become terminated.
*
* @since 1.0.0
*/ */
public abstract void awaitTermination() throws InterruptedException; public abstract void awaitTermination() throws InterruptedException;
} }