Java Code Examples for com.google.common.util.concurrent.Service.State#RUNNING

The following examples show how to use com.google.common.util.concurrent.Service.State#RUNNING . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractSchedulerRuntimeIT.java    From usergrid with Apache License 2.0 6 votes vote down vote up
@Before
@SuppressWarnings( "all" )
public void setup() {

    props = springResource.getBean( "properties", Properties.class );
    scheduler = springResource.getBean( SchedulerService.class );

    if ( System.getProperties().containsKey( COUNT_PROP ) ) {
        count = Integer.getInteger( System.getProperty( COUNT_PROP ) );
    }

    // start the scheduler after we're all set up
    JobSchedulerService jobScheduler = springResource.getBean( JobSchedulerService.class );
    jobScheduler.setJobListener( listener );
    if ( jobScheduler.state() != State.RUNNING ) {
        jobScheduler.startAsync();
        jobScheduler.awaitRunning();
    }
}
 
Example 2
Source File: AbstractRegion.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void initilializeCustomEvictor() {
  LogWriterI18n logger = getSystem().getLogWriter().convertToLogWriterI18n();
  if (getCustomEvictionAttributes() != null
      && !getCustomEvictionAttributes().isEvictIncoming()) {
    State st = getEvictorTask().startAndWait();
    if (st != State.RUNNING) {
      if (logger.fineEnabled()) {
        logger.fine(" The Evictor Service failed to start.");
      }
    }
    if (logger.fineEnabled()) {
      logger.fine(" The Evictor Service started and its state is " + st);
    }
  }
}
 
Example 3
Source File: AbstractService.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@GuardedBy("monitor")
private void stopping(final State from) {
  if (from == State.STARTING) {
    STOPPING_FROM_STARTING_CALLBACK.enqueueOn(listeners);
  } else if (from == State.RUNNING) {
    STOPPING_FROM_RUNNING_CALLBACK.enqueueOn(listeners);
  } else {
    throw new AssertionError();
  }
}
 
Example 4
Source File: AbstractService.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@GuardedBy("monitor")
private void stopping(final State from) {
  if (from == State.STARTING) {
    STOPPING_FROM_STARTING_CALLBACK.enqueueOn(listeners);
  } else if (from == State.RUNNING) {
    STOPPING_FROM_RUNNING_CALLBACK.enqueueOn(listeners);
  } else {
    throw new AssertionError();
  }
}
 
Example 5
Source File: AbstractService.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@GuardedBy("monitor")
private void stopping(final State from) {
  if (from == State.STARTING) {
    STOPPING_FROM_STARTING_CALLBACK.enqueueOn(listeners);
  } else if (from == State.RUNNING) {
    STOPPING_FROM_RUNNING_CALLBACK.enqueueOn(listeners);
  } else {
    throw new AssertionError();
  }
}
 
Example 6
Source File: AbstractService.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@GuardedBy("monitor")
private void stopping(final State from) {
  if (from == State.STARTING) {
    STOPPING_FROM_STARTING_CALLBACK.enqueueOn(listeners);
  } else if (from == State.RUNNING) {
    STOPPING_FROM_RUNNING_CALLBACK.enqueueOn(listeners);
  } else {
    throw new AssertionError();
  }
}
 
Example 7
Source File: AbstractService.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@GuardedBy("monitor")
private void stopping(final State from) {
  if (from == State.STARTING) {
    STOPPING_FROM_STARTING_CALLBACK.enqueueOn(listeners);
  } else if (from == State.RUNNING) {
    STOPPING_FROM_RUNNING_CALLBACK.enqueueOn(listeners);
  } else {
    throw new AssertionError();
  }
}
 
Example 8
Source File: AbstractRegion.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void initilializeCustomEvictor() {
  LogWriterI18n logger = getSystem().getLogWriter().convertToLogWriterI18n();
  if (getCustomEvictionAttributes() != null
      && !getCustomEvictionAttributes().isEvictIncoming()) {
    State st = getEvictorTask().startAndWait();
    if (st != State.RUNNING) {
      if (logger.fineEnabled()) {
        logger.fine(" The Evictor Service failed to start.");
      }
    }
    if (logger.fineEnabled()) {
      logger.fine(" The Evictor Service started and its state is " + st);
    }
  }
}