brooklyn.entity.basic.Entities.submit()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中brooklyn.entity.basic.Entities.submit()方法的一些代码示例,展示了Entities.submit()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entities.submit()方法的具体详情如下:
包路径:brooklyn.entity.basic.Entities
类名称:Entities
方法名:submit

Entities.submit介绍

[英]submits a task to run at the entity
[中]

代码示例

代码示例来源:origin: io.brooklyn/brooklyn-software-webapp

public synchronized void updateNeeded() {
  if (updateNeeded) return;
  updateNeeded = true;
  LOG.debug("queueing an update-needed task for "+this+"; update will occur shortly");
  Entities.submit(this, Tasks.builder().name("update-needed").body(new Runnable() {
    @Override
    public void run() {
      if (updateNeeded)
        AbstractControllerImpl.this.update();
    } 
  }).build());
}

代码示例来源:origin: io.brooklyn/brooklyn-software-base

/**
 * If custom behaviour is required by sub-classes, consider overriding {@link #doStart()}.
 */
@Override
public final void start(final Collection<? extends Location> locations) {
  if (DynamicTasks.getTaskQueuingContext() != null) {
    doStart(locations);
  } else {
    Task<?> task = Tasks.builder().name("start").body(new Runnable() { public void run() { doStart(locations); } }).build();
    Entities.submit(this, task).getUnchecked();
  }
}

代码示例来源:origin: io.brooklyn/brooklyn-software-base

/**
 * If custom behaviour is required by sub-classes, consider overriding {@link #doStop()}.
 */
@Override
public final void restart() {
  if (DynamicTasks.getTaskQueuingContext() != null) {
    doRestart();
  } else {
    Task<?> task = Tasks.builder().name("restart").body(new Runnable() { public void run() { doRestart(); } }).build();
    Entities.submit(this, task).getUnchecked();
  }
}

代码示例来源:origin: io.brooklyn/brooklyn-software-base

/**
 * If custom behaviour is required by sub-classes, consider overriding {@link #doStop()}.
 */
@Override
public final void stop() {
  // TODO There is a race where we set SERVICE_UP=false while sensor-adapter threads may still be polling.
  // The other thread might reset SERVICE_UP to true immediately after we set it to false here.
  // Deactivating adapters before setting SERVICE_UP reduces the race, and it is reduced further by setting
  // SERVICE_UP to false at the end of stop as well.
  
  // Perhaps we should wait until all feeds have completed here, 
  // or do a SERVICE_STATE check before setting SERVICE_UP to true in a feed (?).
  if (DynamicTasks.getTaskQueuingContext() != null) {
    doStop();
  } else {
    Task<?> task = Tasks.builder().name("stop").body(new Runnable() { public void run() { doStop(); } }).build();
    Entities.submit(this, task).getUnchecked();
  }
}

代码示例来源:origin: io.brooklyn/brooklyn-software-nosql

if (isClustered() && !isFirst && CassandraCluster.WAIT_FOR_FIRST) {
  long firstStartTime = Entities.submit(entity, DependentConfiguration.attributeWhenReady(getEntity().getParent(), CassandraCluster.FIRST_NODE_STARTED_TIME_UTC)).getUnchecked();

相关文章