Package alluxio.grpc
Class GrpcServer
- java.lang.Object
-
- alluxio.grpc.GrpcServer
-
public final class GrpcServer extends java.lang.Object
An authenticated gRPC server. Corresponding gRPC channels to this server should be build byGrpcChannelBuilder
.
-
-
Constructor Summary
Constructors Constructor Description GrpcServer(io.grpc.Server server, AuthenticationServer authServer, com.google.common.io.Closer closer, long serverShutdownTimeoutMs)
Create a new instance ofGrpcServer
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
awaitTermination()
Waits until the server is terminated.AuthenticationServer
getAuthenticationServer()
int
getBindPort()
boolean
isServing()
boolean
shutdown()
Shuts down the server.GrpcServer
start()
Start serving.java.lang.String
toString()
-
-
-
Constructor Detail
-
GrpcServer
public GrpcServer(io.grpc.Server server, AuthenticationServer authServer, com.google.common.io.Closer closer, long serverShutdownTimeoutMs)
Create a new instance ofGrpcServer
.- Parameters:
server
- the wrapped serverauthServer
- the authentication servercloser
- resources to close during shutting down of this serverserverShutdownTimeoutMs
- server shutdown timeout in milliseconds
-
-
Method Detail
-
getAuthenticationServer
public AuthenticationServer getAuthenticationServer()
- Returns:
- the authentication server associated with this server
-
start
public GrpcServer start() throws java.io.IOException
Start serving.- Returns:
- this instance of
GrpcServer
- Throws:
java.io.IOException
- when unable to start serving
-
getBindPort
public int getBindPort()
- Returns:
- the port that server is bound to, or null if the server is not bound to an address yet
-
shutdown
public boolean shutdown()
Shuts down the server.- Returns:
true
if the server was successfully terminated
-
awaitTermination
public void awaitTermination()
Waits until the server is terminated.
-
isServing
public boolean isServing()
- Returns:
- true if server is serving
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-