本文整理汇总了Java中org.apache.mesos.Executor类的典型用法代码示例。如果您正苦于以下问题:Java Executor类的具体用法?Java Executor怎么用?Java Executor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Executor类属于org.apache.mesos包,在下文中一共展示了Executor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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);
}
示例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());
}
示例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()";
}
};
}
});
}
示例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()";
}
};
}
});
}
示例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()";
}
};
}
});
}
示例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()";
}
};
}
});
}
示例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()";
}
};
}
});
}
示例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()";
}
};
}
});
}
示例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();
}
示例11: getDriver
import org.apache.mesos.Executor; //导入依赖的package包/类
@Override
public ExecutorDriver getDriver(Executor executor) {
return new MesosExecutorDriver(executor);
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}