mirror of https://github.com/grpc/grpc-java.git
Don't let server start if already shutting down
This commit is contained in:
parent
45c75f2c96
commit
4b27e542e0
|
@ -31,6 +31,7 @@
|
|||
|
||||
package io.grpc.internal;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static io.grpc.internal.GrpcUtil.TIMEOUT_KEY;
|
||||
import static io.grpc.internal.GrpcUtil.TIMER_SERVICE;
|
||||
|
||||
|
@ -114,9 +115,8 @@ public final class ServerImpl extends io.grpc.Server {
|
|||
@Override
|
||||
public ServerImpl start() throws IOException {
|
||||
synchronized (lock) {
|
||||
if (started) {
|
||||
throw new IllegalStateException("Already started");
|
||||
}
|
||||
checkState(!started, "Already started");
|
||||
checkState(!shutdown, "Shutting down");
|
||||
usingSharedExecutor = executor == null;
|
||||
if (usingSharedExecutor) {
|
||||
executor = SharedResourceHolder.get(GrpcUtil.SHARED_CHANNEL_EXECUTOR);
|
||||
|
|
Loading…
Reference in New Issue