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


Java V0Mesos类代码示例

本文整理汇总了Java中org.apache.mesos.v1.scheduler.V0Mesos的典型用法代码示例。如果您正苦于以下问题:Java V0Mesos类的具体用法?Java V0Mesos怎么用?Java V0Mesos使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


V0Mesos类属于org.apache.mesos.v1.scheduler包,在下文中一共展示了V0Mesos类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startInternal

import org.apache.mesos.v1.scheduler.V0Mesos; //导入依赖的package包/类
/**
 * Broken out into a separate function to allow testing with custom `Mesos` implementations.
 */
@VisibleForTesting
protected Mesos startInternal() {
    String version = System.getenv("MESOS_API_VERSION");
    if (version == null) {
        version = "V0";
    }

    LOGGER.info("Using Mesos API version: {}", version);

    if (version.equals("V0")) {
        if (credential == null) {
            return new V0Mesos(this, frameworkInfo, master);
        } else {
            return new V0Mesos(this, frameworkInfo, master, credential);
        }
    } else if (version.equals("V1")) {
        if (credential == null) {
            return new V1Mesos(this, master);
        } else {
            return new V1Mesos(this, master, credential);
        }
    } else {
        throw new IllegalArgumentException("Unsupported API version: " + version);
    }
}
 
开发者ID:mesosphere,项目名称:mesos-http-adapter,代码行数:29,代码来源:MesosToSchedulerDriverAdapter.java

示例2: createInternal

import org.apache.mesos.v1.scheduler.V0Mesos; //导入依赖的package包/类
/**
 * Broken out into a separate function to allow testing with custom SchedulerDrivers.
 */
protected SchedulerDriver createInternal(
        final Scheduler scheduler,
        final FrameworkInfo frameworkInfo,
        final String masterUrl,
        final Credential credential,
        final String mesosAPIVersion) {
    Capabilities capabilities = Capabilities.getInstance();
    if (credential != null) {
        return new MesosToSchedulerDriverAdapter(scheduler, frameworkInfo, masterUrl, true, credential) {
            @Override
            protected Mesos startInternal() {
                if (capabilities.supportsV1APIByDefault()) {
                    return super.startInternal();
                }

                if (mesosAPIVersion.equals("V1")) {
                    LOGGER.warn(
                            "Current DC/OS cluster doesn't support the Mesos V1 API in strict mode. Using V0...");
                }
                return new V0Mesos(
                        this,
                        EvolverDevolver.evolve(frameworkInfo),
                        masterUrl,
                        EvolverDevolver.evolve(credential));
            }
        };
    }

    // Love too work around the fact that the MesosToSchedulerDriverAdapter both depends directly on the
    // process environment *and* uses two unrelated constructors for the case of credential being null
    return new MesosToSchedulerDriverAdapter(scheduler, frameworkInfo, masterUrl, true) {
        @Override
        protected Mesos startInternal() {
            if (capabilities.supportsV1APIByDefault()) {
                return super.startInternal();
            }

            if (mesosAPIVersion.equals("V1")) {
                LOGGER.warn(
                        "Current DC/OS cluster doesn't support the Mesos V1 API in strict mode. Using V0...");
            }
            return new V0Mesos(this, EvolverDevolver.evolve(frameworkInfo), masterUrl);
        }
    };
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:49,代码来源:SchedulerDriverFactory.java


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