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


Java NodeMetadata.Status方法代码示例

本文整理汇总了Java中org.jclouds.compute.domain.NodeMetadata.Status方法的典型用法代码示例。如果您正苦于以下问题:Java NodeMetadata.Status方法的具体用法?Java NodeMetadata.Status怎么用?Java NodeMetadata.Status使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jclouds.compute.domain.NodeMetadata的用法示例。


在下文中一共展示了NodeMetadata.Status方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: waitForState

import org.jclouds.compute.domain.NodeMetadata; //导入方法依赖的package包/类
protected final boolean waitForState(NodeMetadata.Status targetStatus, long timeoutInSeconds) {
    Objects.requireNonNull(targetStatus, "targetStatus");
    LOGGER.debug("Waiting for status '{}' on node '{}' (timeout {}s)", targetStatus.name(), getName(), timeoutInSeconds);
    long endTime = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(timeoutInSeconds);
    while (System.currentTimeMillis() < endTime) {
        NodeMetadata.Status status = getFreshNodeMetadata().getStatus();
        if (status != null && status.equals(targetStatus)) {
            LOGGER.debug("Node '{}' is in status '{}'", getName(), targetStatus.name());
            return true;
        } else if (!NodeMetadata.Status.ERROR.equals(targetStatus) && NodeMetadata.Status.ERROR.equals(status)) {
            // fail fast
            throw new IllegalStateException("Node '" + getName() + "' is in unexpected ERROR state.");
        }

        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            LOGGER.warn("Interrupted while waiting for node '{}' to reach state '{}'", getName(), targetStatus.name(), e);
            Thread.currentThread().interrupt();
            break;
        }
    }

    LOGGER.warn("Node '{}' didn't reach status '{}' in given time ({}s)", getName(), targetStatus.name(), timeoutInSeconds);
    return false;
}
 
开发者ID:wildfly-extras,项目名称:sunstone,代码行数:27,代码来源:AbstractJCloudsNode.java

示例2: setup

import org.jclouds.compute.domain.NodeMetadata; //导入方法依赖的package包/类
@Before
public void setup()
        throws UnknownHostException {
    for (int i = 0; i < NUMBER_OF_NODES; i++) {
        HashSet<String> privateAddresses = new HashSet<String>();
        privateAddresses.add("127.0.0." + (i + 1));
        NodeMetadata.Status status = NodeMetadata.Status.PENDING;
        if (i < NUMBER_OF_RUNNING_NODES) {
            status = NodeMetadata.Status.RUNNING;
            addressesOfRunningInstances.add(new Address(privateAddresses.iterator().next(), 0));
        }
        nodes.add(new NodeMetadataImpl("", "", "dummyId" + i,
                null,
                null,
                new HashMap<String, String>(),
                new HashSet<String>(),
                null, null, null, null,
                status, "",
                STARTING_PORT + i, privateAddresses, privateAddresses, null, "dummyHostName" + i));
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-jclouds,代码行数:22,代码来源:JCloudsDiscoveryStrategyTest.java

示例3: getNodePredicate

import org.jclouds.compute.domain.NodeMetadata; //导入方法依赖的package包/类
/**
 * Returns the required {@ComputeMetadata} {@link Predicate} for the Exhcnage.
 * The predicate can be used for filtering.
 */
public Predicate<NodeMetadata> getNodePredicate(Exchange exchange) {
    final String nodeId = getNodeId(exchange);
    final String imageId = getImageId(exchange);
    final String group = getGroup(exchange);
    final NodeMetadata.Status queryState = getNodeState(exchange);

    Predicate<NodeMetadata> predicate = new Predicate<NodeMetadata>() {
        public boolean apply(NodeMetadata metadata) {
            if (nodeId != null && !nodeId.equals(metadata.getId())) {
                return false;
            }
            if (imageId != null && !imageId.equals(metadata.getImageId())) {
                return false;
            }
            if (queryState != null && !queryState.equals(metadata.getStatus())) {
                return false;
            }
            if (group != null && !group.equals(metadata.getGroup())) {
                return false;
            }
            return true;
        }
    };
    return predicate;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:30,代码来源:JcloudsComputeProducer.java

示例4: getNodeState

import org.jclouds.compute.domain.NodeMetadata; //导入方法依赖的package包/类
/**
 * Retrieves the node state from the URI or from the exchange headers. The header will take precedence over the URI.
 */
public NodeMetadata.Status getNodeState(Exchange exchange) {
    NodeMetadata.Status nodeState = null;
    String state = getEndpoint().getNodeState();
    if (ObjectHelper.isNotEmpty(state)) {
        nodeState =  NodeMetadata.Status.valueOf(state);
    }

    if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(JcloudsConstants.NODE_STATE))) {
        Object stateHeader = exchange.getIn().getHeader(JcloudsConstants.NODE_STATE);
        if (stateHeader == null) {
            nodeState = null;
        } else if (stateHeader instanceof  NodeMetadata.Status) {
            nodeState = (NodeMetadata.Status) stateHeader;
        } else {
            nodeState =  NodeMetadata.Status.valueOf(String.valueOf(stateHeader));
        }
    }
    return nodeState;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:JcloudsComputeProducer.java

示例5: toState

import org.jclouds.compute.domain.NodeMetadata; //导入方法依赖的package包/类
private ComponentInstance.State toState(NodeMetadata.Status status){
    switch (status){
        case ERROR:
            return ComponentInstance.State.ERROR;
        case RUNNING:
            return ComponentInstance.State.RUNNING;
        case SUSPENDED:
            return ComponentInstance.State.STOPPED;
        case TERMINATED:
            return ComponentInstance.State.TERMINATED;
        case PENDING:
            return ComponentInstance.State.PENDING;
        default:
            return ComponentInstance.State.UNRECOGNIZED;
    }

}
 
开发者ID:SINTEF-9012,项目名称:cloudml,代码行数:18,代码来源:OpenStackModule.java

示例6: toState

import org.jclouds.compute.domain.NodeMetadata; //导入方法依赖的package包/类
private ComponentInstance.State toState(NodeMetadata.Status status){
    switch (status){
        case ERROR:
            return ComponentInstance.State.ERROR;
        case RUNNING:
            return ComponentInstance.State.RUNNING;
        case SUSPENDED:
            return ComponentInstance.State.STOPPED;
        case TERMINATED:
            return ComponentInstance.State.TERMINATED;
        case PENDING:
            return ComponentInstance.State.PENDING;
        default:
            return ComponentInstance.State.UNRECOGNIZED;
    }
}
 
开发者ID:SINTEF-9012,项目名称:cloudml,代码行数:17,代码来源:JCloudsModule.java

示例7: ECSComputeServiceAdapter

import org.jclouds.compute.domain.NodeMetadata; //导入方法依赖的package包/类
@Inject
public ECSComputeServiceAdapter(
      ECSApi api,
      Map<Instance.Status, NodeMetadata.Status> nodeStatus) {
   this.api = api;
   this.nodeStatus = nodeStatus;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:8,代码来源:ECSComputeServiceAdapter.java

示例8: getInstanceStatus

import org.jclouds.compute.domain.NodeMetadata; //导入方法依赖的package包/类
@Provides
@Singleton
protected final Map<Instance.Status, NodeMetadata.Status> getInstanceStatus() {
   return ImmutableMap.<Instance.Status, NodeMetadata.Status> builder()
         .put(Instance.Status.RUNNING, NodeMetadata.Status.RUNNING)
         .put(Instance.Status.STOPPED, NodeMetadata.Status.SUSPENDED)
         .put(Instance.Status.DELETED, NodeMetadata.Status.TERMINATED)
         .put(Instance.Status.STARTING, NodeMetadata.Status.PENDING)
         .put(Instance.Status.RESETTING, NodeMetadata.Status.PENDING)
         .put(Instance.Status.TRANSFERRING, NodeMetadata.Status.PENDING)
         .put(Instance.Status.STOPPING, NodeMetadata.Status.PENDING)
         .build();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:14,代码来源:ECSComputeServiceContextModule.java

示例9: VirtualMachineToNodeMetadata

import org.jclouds.compute.domain.NodeMetadata; //导入方法依赖的package包/类
@Inject
public VirtualMachineToNodeMetadata(Map<VirtualMachinePowerState, NodeMetadata.Status> toPortableNodeStatus,
                                    Supplier<Map<String, CustomFieldDef>> customFields,
                                    Supplier<VSphereServiceInstance> serviceInstanceSupplier,
                                    Function<String, DistributedVirtualPortgroup> distributedVirtualPortgroupFunction,
                                    @Named(VSphereConstants.JCLOUDS_VSPHERE_VM_PASSWORD) String vmInitPassword) {
   this.toPortableNodeStatus = checkNotNull(toPortableNodeStatus, "PortableNodeStatus");
   this.customFields = checkNotNull(customFields, "customFields");
   this.serviceInstanceSupplier = checkNotNull(serviceInstanceSupplier, "serviceInstanceSupplier");
   this.distributedVirtualPortgroupFunction = checkNotNull(distributedVirtualPortgroupFunction, "distributedVirtualPortgroupFunction");
   this.vmInitPassword = vmInitPassword;
}
 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:13,代码来源:VirtualMachineToNodeMetadata.java

示例10: InstanceToNodeMetadata

import org.jclouds.compute.domain.NodeMetadata; //导入方法依赖的package包/类
public InstanceToNodeMetadata(
      ECSApi api,
      Map<Instance.Status, NodeMetadata.Status> status) {
   this.api = api;
   this.status = status;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:7,代码来源:InstanceToNodeMetadata.java

示例11: toPortableNodeStatus

import org.jclouds.compute.domain.NodeMetadata; //导入方法依赖的package包/类
@Singleton
@Provides
protected Map<VirtualMachinePowerState, NodeMetadata.Status> toPortableNodeStatus() {
   return toPortableNodeStatus;
}
 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:6,代码来源:VSphereComputeServiceContextModule.java


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