use of org.kohsuke.stapler.export.Exported in project hudson-2.x by hudson.
the class Executor method isLikelyStuck.
/**
* Returns true if the current build is likely stuck.
*
* <p>
* This is a heuristics based approach, but if the build is suspiciously taking for a long time,
* this method returns true.
*/
@Exported
public boolean isLikelyStuck() {
Queue.Executable e = executable;
if (e == null)
return false;
long elapsed = getElapsedTime();
long d = Executables.getEstimatedDurationFor(e);
if (d >= 0) {
// if it's taking 10 times longer than ETA, consider it stuck
return d * 10 < elapsed;
} else {
// if no ETA is available, a build taking longer than a day is considered stuck
return TimeUnit2.MILLISECONDS.toHours(elapsed) > 24;
}
}
use of org.kohsuke.stapler.export.Exported in project hudson-2.x by hudson.
the class Label method getClouds.
/**
* Gets all {@link Cloud}s that can launch for this label.
*/
@Exported
public Set<Cloud> getClouds() {
if (clouds == null) {
Set<Cloud> r = new HashSet<Cloud>();
Hudson h = Hudson.getInstance();
for (Cloud c : h.clouds) {
if (c.canProvision(this))
r.add(c);
}
clouds = Collections.unmodifiableSet(r);
}
return clouds;
}
use of org.kohsuke.stapler.export.Exported in project blueocean-plugin by jenkinsci.
the class Links method getPathFromMethodName.
private String getPathFromMethodName(Method m) {
String methodName = m.getName();
Exported exportedAnn = m.getAnnotation(Exported.class);
if (exportedAnn != null && !exportedAnn.name().trim().isEmpty())
return exportedAnn.name();
if (methodName.startsWith("get")) {
return methodName.substring(3, 4).toLowerCase() + methodName.substring(4);
} else if (methodName.startsWith("do")) {
return methodName.substring(2, 3).toLowerCase() + methodName.substring(3);
} else {
return "";
}
}
use of org.kohsuke.stapler.export.Exported in project blueocean-plugin by jenkinsci.
the class PipelineRunImpl method getCommitUrl.
@Exported(name = "commitUrl")
public String getCommitUrl() {
String commitId = getCommitId();
if (commitId != null) {
Container<BlueChangeSetEntry> changeSets = getChangeSet();
BlueChangeSetEntry entry = changeSets.get(commitId);
if (entry != null) {
return entry.getUrl();
}
}
return null;
}
use of org.kohsuke.stapler.export.Exported in project blueocean-plugin by jenkinsci.
the class BranchImpl method getBranch.
@Exported(name = BRANCH, inline = true)
public Branch getBranch() {
ObjectMetadataAction om = job.getAction(ObjectMetadataAction.class);
PrimaryInstanceMetadataAction pima = job.getAction(PrimaryInstanceMetadataAction.class);
String url = om != null && om.getObjectUrl() != null ? om.getObjectUrl() : null;
return new Branch(url, pima != null);
}
Aggregations