本文整理匯總了Java中org.apache.camel.ServiceStatus.Suspended方法的典型用法代碼示例。如果您正苦於以下問題:Java ServiceStatus.Suspended方法的具體用法?Java ServiceStatus.Suspended怎麽用?Java ServiceStatus.Suspended使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.camel.ServiceStatus
的用法示例。
在下文中一共展示了ServiceStatus.Suspended方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getStatus
import org.apache.camel.ServiceStatus; //導入方法依賴的package包/類
@Override
public ServiceStatus getStatus() {
// we should check the ---ing states first, as this indicate the state is in the middle of doing that
if (isStarting()) {
return ServiceStatus.Starting;
}
if (isStopping()) {
return ServiceStatus.Stopping;
}
if (isSuspending()) {
return ServiceStatus.Suspending;
}
// then check for the regular states
if (isStarted()) {
return ServiceStatus.Started;
}
if (isStopped()) {
return ServiceStatus.Stopped;
}
if (isSuspended()) {
return ServiceStatus.Suspended;
}
// use stopped as fallback
return ServiceStatus.Stopped;
}
示例2: onJobExecute
import org.apache.camel.ServiceStatus; //導入方法依賴的package包/類
protected void onJobExecute(Action action, Route route) throws Exception {
LOG.debug("Scheduled Event notification received. Performing action: {} on route: {}", action, route.getId());
ServiceStatus routeStatus = route.getRouteContext().getCamelContext().getRouteStatus(route.getId());
if (action == Action.START) {
if (routeStatus == ServiceStatus.Stopped) {
startRoute(route);
// here we just check the states of the Consumer
} else if (ServiceHelper.isSuspended(route.getConsumer())) {
startConsumer(route.getConsumer());
}
} else if (action == Action.STOP) {
if ((routeStatus == ServiceStatus.Started) || (routeStatus == ServiceStatus.Suspended)) {
stopRoute(route, getRouteStopGracePeriod(), getTimeUnit());
} else {
LOG.warn("Route is not in a started/suspended state and cannot be stopped. The current route state is {}", routeStatus);
}
} else if (action == Action.SUSPEND) {
if (routeStatus == ServiceStatus.Started) {
stopConsumer(route.getConsumer());
} else {
LOG.warn("Route is not in a started state and cannot be suspended. The current route state is {}", routeStatus);
}
} else if (action == Action.RESUME) {
if (routeStatus == ServiceStatus.Started) {
if (ServiceHelper.isSuspended(route.getConsumer())) {
startConsumer(route.getConsumer());
} else {
LOG.warn("The Consumer {} is not suspended and cannot be resumed.", route.getConsumer());
}
} else {
LOG.warn("Route is not in a started state and cannot be resumed. The current route state is {}", routeStatus);
}
}
}