当前位置: 首页>>代码示例>>Java>>正文


Java ServiceStatus.Suspended方法代码示例

本文整理汇总了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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:28,代码来源:ServiceSupport.java

示例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);
        }
    }       
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:36,代码来源:ScheduledRoutePolicy.java


注:本文中的org.apache.camel.ServiceStatus.Suspended方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。