• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Executor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: MockExecutorDriver

import org.apache.mesos.Executor; //导入依赖的package包/类
public MockExecutorDriver(@NotNull final Executor executor, @NotNull final Protos.ExecutorID executorId) {
    this.executor = executor;

    slaveInfo = Protos.SlaveInfo.newBuilder()
            .setHostname("localhost")
            .setId(Protos.SlaveID.newBuilder().setValue(UUID.randomUUID().toString()))
            .setPort(42)
            .build();
    frameworkInfo = Protos.FrameworkInfo.newBuilder()
            .setHostname(slaveInfo.getHostname())
            .setId(Protos.FrameworkID.newBuilder().setValue(UUID.randomUUID().toString()))
            .setName("some-framework")
            .setUser("me-myself-and-i")
            .build();
    executorInfo = Protos.ExecutorInfo.newBuilder()
            .setExecutorId(executorId)
            .setCommand(Protos.CommandInfo.getDefaultInstance())
            .setContainer(Protos.ContainerInfo.newBuilder()
                    .setType(Protos.ContainerInfo.Type.MESOS))
            .setFrameworkId(frameworkInfo.getId())
            .setSource("source")
            .build();
}
 
开发者ID:mesosphere,项目名称:cassandra-mesos-deprecated,代码行数:24,代码来源:MockExecutorDriver.java


示例2: CassandraDaemonController

import org.apache.mesos.Executor; //导入依赖的package包/类
/**
 * Constructs a new controller.
 * @param executor The Executor instance that will be controlled.
 */
@Inject
public CassandraDaemonController(Executor executor) {

    LOGGER.info("Setting executor to {}", executor);
    this.executor = (CassandraExecutor) executor;
    LOGGER.info("Set executor to {}", this.executor);
}
 
开发者ID:mesosphere,项目名称:dcos-cassandra-service,代码行数:12,代码来源:CassandraDaemonController.java


示例3: JesosExecutorDriver

import org.apache.mesos.Executor; //导入依赖的package包/类
public JesosExecutorDriver(final Executor executor) throws IOException
{
    this(executor,
         UPID.create(System.getenv("MESOS_SLAVE_PID")),
         SlaveID.newBuilder().setValue(System.getenv("MESOS_SLAVE_ID")).build(),
         FrameworkID.newBuilder().setValue(System.getenv("MESOS_FRAMEWORK_ID")).build(),
         ExecutorID.newBuilder().setValue(System.getenv("MESOS_EXECUTOR_ID")).build());
}
 
开发者ID:groupon,项目名称:jesos,代码行数:9,代码来源:JesosExecutorDriver.java


示例4: executorRegistered

import org.apache.mesos.Executor; //导入依赖的package包/类
@Subscribe
public void executorRegistered(final ExecutorRegisteredMessageEnvelope envelope)
{
    checkState(envelope.getRecipient().equals(context.getDriverUPID()), "Received a remote message for local delivery");

    if (context.isStateMachine(DRIVER_ABORTED)) {
        LOG.warn("driver is aborted!");
        return;
    }

    final ExecutorRegisteredMessage message = envelope.getMessage();

    eventBus.post(new ExecutorCallback() {
        @Override
        public Runnable getCallback(final Executor executor, final ExecutorDriver executorDriver)
        {
            return new Runnable() {
                @Override
                public void run()
                {
                    executor.registered(executorDriver, message.getExecutorInfo(), message.getFrameworkInfo(), message.getSlaveInfo());
                }

                @Override
                public String toString()
                {
                    return "callback for registered()";
                }
            };
        }
    });
}
 
开发者ID:groupon,项目名称:jesos,代码行数:33,代码来源:LocalExecutorMessageProcessor.java


示例5: executorReregistered

import org.apache.mesos.Executor; //导入依赖的package包/类
@Subscribe
public void executorReregistered(final ExecutorReregisteredMessageEnvelope envelope)
{
    checkState(envelope.getRecipient().equals(context.getDriverUPID()), "Received a remote message for local delivery");

    if (context.isStateMachine(DRIVER_ABORTED)) {
        LOG.warn("driver is aborted!");
        return;
    }

    final ExecutorReregisteredMessage message = envelope.getMessage();

    eventBus.post(new ExecutorCallback() {
        @Override
        public Runnable getCallback(final Executor executor, final ExecutorDriver executorDriver)
        {
            return new Runnable() {
                @Override
                public void run()
                {
                    executor.reregistered(executorDriver, message.getSlaveInfo());
                }

                @Override
                public String toString()
                {
                    return "callback for reregistered()";
                }
            };
        }
    });
}
 
开发者ID:groupon,项目名称:jesos,代码行数:33,代码来源:LocalExecutorMessageProcessor.java


示例6: runTask

import org.apache.mesos.Executor; //导入依赖的package包/类
@Subscribe
public void runTask(final RunTaskMessageEnvelope envelope)
{
    checkState(envelope.getRecipient().equals(context.getDriverUPID()), "Received a remote message for local delivery");

    if (context.isStateMachine(DRIVER_ABORTED)) {
        LOG.warn("driver is aborted!");
        return;
    }

    final RunTaskMessage message = envelope.getMessage();

    final TaskInfo task = message.getTask();

    checkState(!tasks.containsKey(task.getTaskId()), "Task %s already started!", task.getTaskId().getValue());

    tasks.put(task.getTaskId(), task);

    eventBus.post(new ExecutorCallback() {
        @Override
        public Runnable getCallback(final Executor executor, final ExecutorDriver executorDriver)
        {
            return new Runnable() {
                @Override
                public void run()
                {
                    executor.launchTask(executorDriver, task);
                }

                @Override
                public String toString()
                {
                    return "callback for launchTask()";
                }
            };
        }
    });
}
 
开发者ID:groupon,项目名称:jesos,代码行数:39,代码来源:LocalExecutorMessageProcessor.java


示例7: killTask

import org.apache.mesos.Executor; //导入依赖的package包/类
@Subscribe
public void killTask(final KillTaskMessageEnvelope envelope)
{
    checkState(envelope.getRecipient().equals(context.getDriverUPID()), "Received a remote message for local delivery");

    if (context.isStateMachine(DRIVER_ABORTED)) {
        LOG.warn("driver is aborted!");
        return;
    }

    final KillTaskMessage message = envelope.getMessage();

    eventBus.post(new ExecutorCallback() {
        @Override
        public Runnable getCallback(final Executor executor, final ExecutorDriver executorDriver)
        {
            return new Runnable() {
                @Override
                public void run()
                {
                    executor.killTask(executorDriver, message.getTaskId());
                }

                @Override
                public String toString()
                {
                    return "callback for killTask()";
                }
            };
        }
    });
}
 
开发者ID:groupon,项目名称:jesos,代码行数:33,代码来源:LocalExecutorMessageProcessor.java


示例8: frameworkToExecutor

import org.apache.mesos.Executor; //导入依赖的package包/类
@Subscribe
public void frameworkToExecutor(final FrameworkToExecutorMessageEnvelope envelope)
{
    checkState(envelope.getRecipient().equals(context.getDriverUPID()), "Received a remote message for local delivery");

    if (context.isStateMachine(DRIVER_ABORTED)) {
        LOG.warn("driver is aborted!");
        return;
    }

    final FrameworkToExecutorMessage message = envelope.getMessage();

    eventBus.post(new ExecutorCallback() {
        @Override
        public Runnable getCallback(final Executor executor, final ExecutorDriver executorDriver)
        {
            return new Runnable() {
                @Override
                public void run()
                {
                    executor.frameworkMessage(executorDriver, message.getData().toByteArray());
                }

                @Override
                public String toString()
                {
                    return "callback for frameworkMessage()";
                }
            };
        }
    });
}
 
开发者ID:groupon,项目名称:jesos,代码行数:33,代码来源:LocalExecutorMessageProcessor.java


示例9: shutdownExecutor

import org.apache.mesos.Executor; //导入依赖的package包/类
@Subscribe
public void shutdownExecutor(final ShutdownExecutorMessageEnvelope envelope)
{
    checkState(envelope.getRecipient().equals(context.getDriverUPID()), "Received a remote message for local delivery");

    if (context.isStateMachine(DRIVER_ABORTED)) {
        LOG.warn("driver is aborted!");
        return;
    }

    eventBus.post(new ExecutorCallback() {
        @Override
        public Runnable getCallback(final Executor executor, final ExecutorDriver executorDriver)
        {
            return new Runnable() {
                @Override
                public void run()
                {
                    executorDriver.abort();
                    executor.shutdown(executorDriver);
                }

                @Override
                public String toString()
                {
                    return "callback for abort()";
                }
            };
        }
    });
}
 
开发者ID:groupon,项目名称:jesos,代码行数:32,代码来源:LocalExecutorMessageProcessor.java


示例10: configure

import org.apache.mesos.Executor; //导入依赖的package包/类
@Override
protected void configure() {
    bind(ExecutorService.class).toInstance(Executors.newCachedThreadPool());
    bind(Executor.class).to(CassandraExecutor.class).asEagerSingleton();
    bind(ExecutorDriverFactory.class).to(MesosExecutorDriverFactory.class).asEagerSingleton();
}
 
开发者ID:mesosphere,项目名称:dcos-cassandra-service,代码行数:7,代码来源:ExecutorModule.java


示例11: getDriver

import org.apache.mesos.Executor; //导入依赖的package包/类
@Override
public ExecutorDriver getDriver(Executor executor) {
    return new MesosExecutorDriver(executor);
}
 
开发者ID:mesosphere,项目名称:dcos-cassandra-service,代码行数:5,代码来源:MesosExecutorDriverFactory.java


示例12: provideDockerComposeExecutor

import org.apache.mesos.Executor; //导入依赖的package包/类
@Provides
Executor provideDockerComposeExecutor(ComposeFileList fileFetcher, DockerComposeProcessObserver processObserver,
                                      ComposeMonitor composeMonitor, ComposeRewriteHelper helper) {
    return new DockerComposeExecutor(fileFetcher, processObserver, composeMonitor, helper);
}
 
开发者ID:mesos,项目名称:docker-compose-executor,代码行数:6,代码来源:ExecutorModule.java


示例13: main

import org.apache.mesos.Executor; //导入依赖的package包/类
public static void main(String[] args) {
	ExecutorComponent executorComponent = DaggerExecutorComponent.builder().build();
	Executor executor = executorComponent.getExecutor();
	ExecutorDriver driver= new MesosExecutorDriver(executor);
	driver.run();
}
 
开发者ID:mesos,项目名称:docker-compose-executor,代码行数:7,代码来源:App.java


示例14: provideDockerComposeExecutor

import org.apache.mesos.Executor; //导入依赖的package包/类
@Provides Executor provideDockerComposeExecutor(FileFetcher fileFetcher,DockerEventStreamListener streamListener,
		DockerEventObserver eventObserver,DockerComposeProcessObserver processObserver){
	return new DockerComposeExecutor(fileFetcher,streamListener,eventObserver,processObserver);
}
 
开发者ID:mohitsoni,项目名称:compose-executor,代码行数:5,代码来源:ExecutorModule.java


示例15: InternalExecutorDriver

import org.apache.mesos.Executor; //导入依赖的package包/类
protected InternalExecutorDriver(final Executor executor,
                                 final UPID slaveUpid,
                                 final SlaveID slaveId,
                                 final FrameworkID frameworkId,
                                 final ExecutorID executorId) throws IOException
{
    this.executor = checkNotNull(executor, "executor is null");

    checkNotNull(slaveUpid, "slaveUpid is null");
    checkNotNull(slaveId, "slaveId is null");
    checkNotNull(frameworkId, "frameworkId is null");
    checkNotNull(executorId, "executorId is null");

    LOG.debug("Slave UPID:       %s", slaveUpid.asString());
    LOG.debug("Slave ID:         %s", slaveId.getValue());
    LOG.debug("Framework ID:     %s", frameworkId.getValue());
    LOG.debug("Executor ID:      %s", executorId.getValue());

    // Enforce using of the IP, when using the hostname this might "flap" between IPs which in turn
    // confuses the heck out of Mesos.
    final String hostName = NetworkUtil.findPublicIp();

    LOG.debug("Host name:        %s", hostName);

    this.context = new ExecutorDriverContext(hostName, slaveUpid, slaveId, frameworkId, executorId);

    this.eventBus = new ManagedEventBus("executor");

    this.localMessageProcessor = new LocalExecutorMessageProcessor(context, eventBus);

    // Closer closes in reverse registration order.

    // Close the callback executor last, so that everything that was still scheduled to be delivered to the framework still has a chance.
    this.callbackExecutor = closer.register(CloseableExecutors.decorate(Executors.newScheduledThreadPool(5, new ThreadFactoryBuilder().setDaemon(true).setNameFormat("executor-callback-%d").build())));

    this.receiver = closer.register(new HttpProtocolReceiver(context.getDriverUPID(), ExecutorMessageEnvelope.class, eventBus));

    // The sender is closed before the receiver, so that possible responses are still caught
    this.sender = closer.register(new HttpProtocolSender(context.getDriverUPID()));

    // Make sure that the event bus is drained first at shutdown.
    closer.register(eventBus);
}
 
开发者ID:groupon,项目名称:jesos,代码行数:44,代码来源:InternalExecutorDriver.java


示例16: ExecutorDriverDispatcher

import org.apache.mesos.Executor; //导入依赖的package包/类
/**
 * Constructs a new ExecutorDriverDispatcher
 * @param driverFactory The ExecutorDriverFactroy that will be used to
 *                      retrieve the ExecutorDriver
 * @param executor The Executor corresponding to the ExecutorDriver.
 * @param executorService The ExecutorService used to execute the
 *                        ExecutorDriver.
 */
@Inject
public ExecutorDriverDispatcher(final ExecutorDriverFactory driverFactory,
                                final Executor executor,
                                final ExecutorService executorService) {
    this.driver = driverFactory.getDriver(executor);
    this.executor = executorService;
}
 
开发者ID:mesosphere,项目名称:dcos-cassandra-service,代码行数:16,代码来源:ExecutorDriverDispatcher.java


示例17: getDriver

import org.apache.mesos.Executor; //导入依赖的package包/类
/**
 * Gets a driver.
 * @param executor The Executor for which the driver will be returned.
 * @return The ExecutorDriver for executor
 */
ExecutorDriver getDriver(Executor executor);
 
开发者ID:mesosphere,项目名称:dcos-cassandra-service,代码行数:7,代码来源:ExecutorDriverFactory.java


示例18: getExecutor

import org.apache.mesos.Executor; //导入依赖的package包/类
Executor getExecutor(); 
开发者ID:mesos,项目名称:docker-compose-executor,代码行数:2,代码来源:ExecutorComponent.java


示例19: getCallback

import org.apache.mesos.Executor; //导入依赖的package包/类
Runnable getCallback(Executor executor, ExecutorDriver executorDriver); 
开发者ID:groupon,项目名称:jesos,代码行数:2,代码来源:ExecutorCallback.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MultiException类代码示例发布时间:2022-05-21
下一篇:
Java AnnotationNode类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap