@Test public void transportServerFailsStartup() { final IOException ex = new IOException(); class FailingStartupServer extends SimpleServer { @Override public void start(ServerListener listener) throws IOException { throw ex; } } transportServer = new FailingStartupServer(); createServer(); try { server.start(); fail("expected exception"); } catch (IOException e) { assertSame(ex, e); } verifyNoMoreInteractions(executorPool); }
@Override public ServerImpl start() throws IOException { synchronized (lock) { checkState(!started, "Already started"); checkState(!shutdown, "Shutting down"); transportServer.start(new ServerListenerImpl()); executor = Preconditions.checkNotNull(executorPool.getObject(), "executor"); started = true; new Thread(registerRunnable, SERVER_REGISTRY_THREAD_NAME).start(); return this; } }
ServerImpl extends io.grpc.Server implements InternalInstrumented<ServerStats> { @Override public ServerImpl start() throws IOException { synchronized (lock) { checkState(!started, "Already started"); checkState(!shutdown, "Shutting down"); transportServer.start(new ServerListenerImpl()); executor = Preconditions.checkNotNull(executorPool.getObject(), "executor"); started = true; new Thread(registerRunnable, SERVER_REGISTRY_THREAD_NAME).start(); return this; } } }
ServerImpl extends io.grpc.Server implements InternalInstrumented<ServerStats> { @Override public ServerImpl start() throws IOException { synchronized (lock) { checkState(!started, "Already started"); checkState(!shutdown, "Shutting down"); transportServer.start(new ServerListenerImpl()); executor = Preconditions.checkNotNull(executorPool.getObject(), "executor"); started = true; new Thread(registerRunnable, SERVER_REGISTRY_THREAD_NAME).start(); return this; } } ServerImpl(
      AbstractServerImplBuilder<?> builder,
      InternalServer transportServer,
      Context rootContext); }
ServerImpl extends io.grpc.Server implements InternalInstrumented<ServerStats> { @Override public ServerImpl start() throws IOException { synchronized (lock) { checkState(!started, "Already started"); checkState(!shutdown, "Shutting down"); transportServer.start(new ServerListenerImpl()); executor = Preconditions.checkNotNull(executorPool.getObject(), "executor"); started = true; new Thread(registerRunnable, SERVER_REGISTRY_THREAD_NAME).start(); return this; } } ServerImpl(
      AbstractServerImplBuilder<?> builder,
      InternalServer transportServer,
      Context rootContext); @Override ServerImpl start(); @Override int getPort(); @Override List<ServerServiceDefinition> getServices(); @Override List<ServerServiceDefinition> getImmutableServices(); @Override List<ServerServiceDefinition> getMutableServices(); @Override ServerImpl shutdown(); @Override ServerImpl shutdownNow(); @Override boolean isShutdown(); @Override boolean awaitTermination(long timeout, TimeUnit unit); @Override void awaitTermination(); @Override boolean isTerminated(); @Override InternalLogId getLogId(); @Override ListenableFuture<ServerStats> getStats(); @Override HandlerRegistry getRegistry(); @Override String toString(); }
ServerImpl extends io.grpc.Server implements InternalInstrumented<ServerStats> { @Override public ServerImpl start() throws IOException { synchronized (lock) { checkState(!started, "Already started"); checkState(!shutdown, "Shutting down"); transportServer.start(new ServerListenerImpl()); executor = Preconditions.checkNotNull(executorPool.getObject(), "executor"); started = true; new Thread(registerRunnable, SERVER_REGISTRY_THREAD_NAME).start(); return this; } } ServerImpl(
      AbstractServerImplBuilder<?> builder,
      InternalServer transportServer,
      Context rootContext); @Override ServerImpl start(); @Override int getPort(); @Override List<ServerServiceDefinition> getServices(); @Override List<ServerServiceDefinition> getImmutableServices(); @Override List<ServerServiceDefinition> getMutableServices(); @Override ServerImpl shutdown(); @Override ServerImpl shutdownNow(); @Override boolean isShutdown(); @Override boolean awaitTermination(long timeout, TimeUnit unit); @Override void awaitTermination(); @Override boolean isTerminated(); @Override InternalLogId getLogId(); @Override ListenableFuture<ServerStats> getStats(); @Override HandlerRegistry getRegistry(); @Override String toString();  }