本文整理了Java中org.apache.brooklyn.core.entity.Entities.waitFor()
方法的一些代码示例,展示了Entities.waitFor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entities.waitFor()
方法的具体详情如下:
包路径:org.apache.brooklyn.core.entity.Entities
类名称:Entities
方法名:waitFor
[英]Waits until the passed entity satisfies the supplied predicate.
[中]等待,直到传递的实体满足提供的谓词。
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
/** Waits until {@link Startable#SERVICE_UP} is true. */
public static void waitForServiceUp(final Entity entity, Duration timeout) {
waitFor(entity, EntityPredicates.isServiceUp(), timeout);
}
public static void waitForServiceUp(final Entity entity, long duration, TimeUnit units) {
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testWaitFor() throws Exception {
entity = app.createAndManageChild(EntitySpec.create(TestEntity.class));
Duration timeout = Duration.ONE_MILLISECOND;
Entities.waitFor(entity, applicationIdEqualTo(app.getApplicationId()), timeout);
try {
Entities.waitFor(entity, applicationIdEqualTo(app.getApplicationId() + "-wrong"), timeout);
Asserts.shouldHaveFailedPreviously("Entities.waitFor() should have timed out");
} catch (Exception e) {
Asserts.expectedFailureContains(e, "Timeout waiting for ");
}
}
内容来源于网络,如有侵权,请联系作者删除!