本文整理汇总了Java中org.apache.brooklyn.rest.domain.Status类的典型用法代码示例。如果您正苦于以下问题:Java Status类的具体用法?Java Status怎么用?Java Status使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Status类属于org.apache.brooklyn.rest.domain包,在下文中一共展示了Status类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: waitForAppStatus
import org.apache.brooklyn.rest.domain.Status; //导入依赖的package包/类
/**
* Polls Brooklyn until the given application has the given status. Quits early if the application's
* status is {@link org.apache.brooklyn.rest.domain.Status#ERROR} or {@link org.apache.brooklyn.rest.domain.Status#UNKNOWN}
* and desiredStatus is something else.
* @return the final polled status
*/
protected Status waitForAppStatus(final String application, final Status desiredStatus) {
final AtomicReference<Status> appStatus = new AtomicReference<Status>(Status.UNKNOWN);
final boolean shortcutOnError = !Status.ERROR.equals(desiredStatus) && !Status.UNKNOWN.equals(desiredStatus);
getLog().info("Waiting " + getTimeout() + " from " + new Date() + " for application " + application + " to be " + desiredStatus);
Repeater.create("Waiting for application " + application + " status to be " + desiredStatus)
.every(getPollPeriod())
.limitTimeTo(getTimeout())
.rethrowExceptionImmediately()
.until(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
Status status = getApi().getApplicationApi().get(application).getStatus();
getLog().debug("Application " + application + " status is: " + status);
appStatus.set(status);
return desiredStatus.equals(status) || (shortcutOnError &&
(Status.ERROR.equals(status) || Status.UNKNOWN.equals(status)));
}
})
.run();
if (appStatus.get().equals(desiredStatus)) {
getLog().info("Application " + application + " is " + desiredStatus.name());
} else {
getLog().warn("Application is not " + desiredStatus.name() + " within " + getTimeout() +
". Status is: " + appStatus.get());
}
return appStatus.get();
}
示例2: waitForAppStatusOrThrow
import org.apache.brooklyn.rest.domain.Status; //导入依赖的package包/类
/**
* Throws a {@link MojoFailureException} if the given application's status is
* not desiredStatus within the configured {@link #timeout}.
*/
protected void waitForAppStatusOrThrow(String application, Status desiredStatus) throws MojoFailureException {
Status finalStatus = waitForAppStatus(application, desiredStatus);
if (!finalStatus.equals(desiredStatus)) {
throw new MojoFailureException("Application is not " + desiredStatus.name() +
" within " + getTimeout() + ". Is: " + finalStatus);
}
}
示例3: waitForRunningAndThrowOtherwise
import org.apache.brooklyn.rest.domain.Status; //导入依赖的package包/类
private void waitForRunningAndThrowOtherwise(String appId, String taskId) throws MojoFailureException {
Status finalStatus = waitForAppStatus(appId, Status.RUNNING);
if (!Status.RUNNING.equals(finalStatus)) {
getLog().error("Application is not running. Is: " + finalStatus.name().toLowerCase());
StringBuilder message = new StringBuilder();
message.append("Application ").append(appId)
.append(" should be running but is ").append(finalStatus.name().toLowerCase())
.append(". ");
if (stopAppOnDeployError) {
try {
new StopApplicationMojo(server, appId).execute();
message.append("The application was requested to stop.");
} catch (Exception e) {
message.append("It was not possible to stop the application; its resources may still be running: ")
.append(e.getMessage());
}
} else {
message.append("It was not requested to stop; its resources may still be running.");
}
if (Status.ERROR.equals(finalStatus) || Status.UNKNOWN.equals(finalStatus)) {
String result = getTaskResult(taskId);
message.append("\nThe result of the task on the server was:\n")
.append(result);
}
throw new MojoFailureException(message.toString());
}
}
示例4: doIt
import org.apache.brooklyn.rest.domain.Status; //导入依赖的package包/类
@Override
public void doIt() throws MojoFailureException {
if (skipExecution()) {
getLog().info("Tests are skipped.");
return;
}
Map<String, Object> matches;
try {
if (waitForRunning) {
waitForAppStatusOrThrow(application, Status.RUNNING);
}
matches = getApi().getEntityApi().getDescendantsSensor(
application, application, sensor, typeRegex);
if (failIfNoMatches && matches.isEmpty()) {
throw new MojoFailureException("No entities in " + application + " matching " + typeRegex +
" have a value for " + sensor);
}
} catch (Exception e) {
if (getForker() != null && shouldTearDownOnFailure()) {
getForker().cleanUp();
}
throw e;
}
getLog().info("Matches: " + Joiner.on(", ").withKeyValueSeparator("=").join(matches));
String value;
if (matches.keySet().size() == 1) {
value = Iterables.getOnlyElement(matches.values()).toString();
} else {
value = Iterables.toString(matches.values());
}
getLog().debug("Setting " + sensorValueProperty + " to " + value);
getProject().getProperties().setProperty(sensorValueProperty, value);
}
示例5: getDeploymentStatus
import org.apache.brooklyn.rest.domain.Status; //导入依赖的package包/类
@JsonProperty
public Status getDeploymentStatus() {
return deploymentStatus;
}
示例6: setDeploymentStatus
import org.apache.brooklyn.rest.domain.Status; //导入依赖的package包/类
public void setDeploymentStatus(Status deploymentStatus) {
this.deploymentStatus = deploymentStatus;
}