Guava Service.State - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Guava Service.State class.

This code example shows how to use the following methods:toString
 
    try { 
      service.start().get(1, TimeUnit.MILLISECONDS);
      fail("Expected timeout");
    } catch (TimeoutException e) {
      assertTrue(e.getMessage().contains(State.STARTING.toString()));
    } 
  } 
 
  private class NullService extends AbstractIdleService {
    boolean startUpCalled = false;
    boolean shutDownCalled = false;
    State expectedShutdownState = State.STOPPING;
 
    @Override protected void startUp() { 
      assertFalse(startUpCalled);
      assertFalse(shutDownCalled);
      startUpCalled = true;
      assertEquals(State.STARTING, state());
    } 
4
CodeRank