下面列出了com.google.common.util.concurrent.Service.State#RUNNING 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@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();
}
}
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);
}
}
}
@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();
}
}
@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();
}
}
@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();
}
}
@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();
}
}
@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();
}
}
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);
}
}
}