org.apache.brooklyn.core.entity.Entities.attributeSupplierWhenReady()方法的使用及代码示例

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

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

Entities.attributeSupplierWhenReady介绍

暂无

代码示例

代码示例来源:origin: org.apache.brooklyn/brooklyn-software-messaging

public List<String> getZookeeperServers() {
  ZooKeeperEnsemble zooKeeperEnsemble = entity.getConfig(Storm.ZOOKEEPER_ENSEMBLE);
  Supplier<List<String>> supplier = Entities.attributeSupplierWhenReady(zooKeeperEnsemble, ZooKeeperEnsemble.ZOOKEEPER_SERVERS);
  return supplier.get();
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-software-messaging

public List<ZooKeeperServerConfig> getZookeeperServers() throws ExecutionException, InterruptedException {
  List<ZooKeeperServerConfig> result = Lists.newArrayList();
  if (entity.getParent() instanceof ZooKeeperEnsemble) {
    ZooKeeperEnsemble ensemble = (ZooKeeperEnsemble) entity.getParent();
    for (Entity member : ensemble.getMembers()) {
      Integer memberId = member.config().get(ZooKeeperNode.MY_ID);
      if (memberId == null) {
        throw new IllegalStateException(member + " has null value for " + ZooKeeperNode.MY_ID);
      }
      String hostname = Entities.attributeSupplierWhenReady(member, ZooKeeperNode.SUBNET_HOSTNAME).get();
      Integer port = Entities.attributeSupplierWhenReady(member, ZooKeeperNode.ZOOKEEPER_PORT).get();
      Integer leaderPort = Entities.attributeSupplierWhenReady(member, ZooKeeperNode.ZOOKEEPER_LEADER_PORT).get();
      Integer electionPort = Entities.attributeSupplierWhenReady(member, ZooKeeperNode.ZOOKEEPER_ELECTION_PORT).get();
      result.add(new ZooKeeperServerConfig(memberId, hostname, port, leaderPort, electionPort));
    }
  }
  return result;
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

@Override public void run() {
    result.set(Entities.attributeSupplierWhenReady(entity, TestEntity.NAME).get());
    
  }});
try {

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

public static <T> Supplier<T> attributeSupplierWhenReady(EntityAndAttribute<T> tuple) {
  return attributeSupplierWhenReady(tuple.getEntity(), tuple.getAttribute());
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

assertEquals(Entities.attributeSupplierWhenReady(entity, TestEntity.NAME).get(), "myname");

代码示例来源:origin: io.brooklyn.clocker/brooklyn-clocker-docker

@Override
public void postStart() {
  Entities.waitForServiceUp(this);
  sensors().get(DOCKER_CONTAINER_CLUSTER).sensors().set(SERVICE_UP, Boolean.TRUE);
  if (Boolean.TRUE.equals(sensors().get(DOCKER_INFRASTRUCTURE).config().get(SdnAttributes.SDN_ENABLE))) {
    LOG.info("Waiting on SDN agent");
    SdnAgent agent = Entities.attributeSupplierWhenReady(this, SdnAgent.SDN_AGENT).get();
    Entities.waitForServiceUp(agent);
    LOG.info("SDN agent running: " + agent.sensors().get(SERVICE_UP));
  }
  String imageId = config().get(DOCKER_IMAGE_ID);
  if (Strings.isBlank(imageId)) {
    String dockerfileUrl = config().get(DockerInfrastructure.DOCKERFILE_URL);
    String imageName = DockerUtils.imageName(this, dockerfileUrl);
    imageId = buildImage(dockerfileUrl, null, null, imageName, config().get(DockerHost.DOCKER_USE_SSH), ImmutableMap.<String, Object>of("fullyQualifiedImageName", imageName));
    sensors().set(DOCKER_IMAGE_NAME, imageName);
  }
  sensors().set(DOCKER_IMAGE_ID, imageId);
  scan = scanner();
  // If a registry URL is configured with credentials then log in
  String registryUrl = config().get(DockerInfrastructure.DOCKER_IMAGE_REGISTRY_URL);
  Boolean internalRegistry = config().get(DockerInfrastructure.DOCKER_SHOULD_START_REGISTRY);
  if (Strings.isNonBlank(registryUrl) && !internalRegistry) {
    String username = config().get(DockerInfrastructure.DOCKER_IMAGE_REGISTRY_USERNAME);
    String password = config().get(DockerInfrastructure.DOCKER_IMAGE_REGISTRY_PASSWORD);
    if (Strings.isNonBlank(username) && Strings.isNonBlank(password)) {
      runDockerCommand(String.format("login  -e \"fake@example.org\" -u %s -p %s %s", username, password, registryUrl));
    }
  }
}

代码示例来源:origin: io.brooklyn.clocker/brooklyn-clocker-docker

SdnAgent agent = Entities.attributeSupplierWhenReady(dockerHost, SdnAgent.SDN_AGENT).get();
List<String> networks = sensors().get(SdnAttributes.ATTACHED_NETWORKS);
Set<String> addresses = Sets.newHashSet();

相关文章