本文整理汇总了Java中hudson.slaves.OfflineCause类的典型用法代码示例。如果您正苦于以下问题:Java OfflineCause类的具体用法?Java OfflineCause怎么用?Java OfflineCause使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OfflineCause类属于hudson.slaves包,在下文中一共展示了OfflineCause类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: markOffline
import hudson.slaves.OfflineCause; //导入依赖的package包/类
@Override
public boolean markOffline(Computer c, OfflineCause oc) {
initPython();
if (pexec.isImplemented(3)) {
return pexec.execPythonBool("mark_offline", c, oc);
} else {
return super.markOffline(c, oc);
}
}
示例2: checkInternal
import hudson.slaves.OfflineCause; //导入依赖的package包/类
/**
* Checks if the computer has expired and marks it for deletion.
* {@link org.jenkinsci.plugins.mesos.MesosCleanupThread} will then come around and terminate those tasks
* @param c The Mesos Computer
* @return The number of minutes to check again afterwards
*/
private long checkInternal(MesosComputer c) {
MesosSlave node = c.getNode();
if (node == null || node.isPendingDelete()) {
return 1;
}
// If we just launched this computer, check back after 1 min.
// NOTE: 'c.getConnectTime()' refers to when the Jenkins slave was launched.
if ((DateTimeUtils.currentTimeMillis() - c.getConnectTime()) <
MINUTES.toMillis(idleTerminationMinutes < 1 ? 1 : idleTerminationMinutes)) {
return 1;
}
// Terminate the computer if it is idle for longer than
// 'idleTerminationMinutes'.
if (isTerminable() && c.isIdle()) {
final long idleMilliseconds =
DateTimeUtils.currentTimeMillis() - c.getIdleStartMilliseconds();
if (idleMilliseconds > MINUTES.toMillis(idleTerminationMinutes)) {
LOGGER.info("Disconnecting idle computer " + c.getName());
node.setPendingDelete(true);
if (!c.isOffline()) {
c.setTemporarilyOffline(true, OfflineCause.create(Messages._MesosRetentionStrategy_DeletedCause()));
}
}
}
return 1;
}
示例3: tearDown
import hudson.slaves.OfflineCause; //导入依赖的package包/类
@Override
public void tearDown(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException {
Computer computer = workspace.toComputer();
if (computer == null) {
throw new IllegalStateException("Computer is null");
}
if (MesosComputer.class.isInstance(computer)) {
String msg = "Taking single-use slave " + computer.getName() + " offline.";
LOGGER.warning(msg);
listener.getLogger().println(msg);
computer.setTemporarilyOffline(true, OfflineCause.create(Messages._MesosSingleUseSlave_OfflineCause()));
} else {
listener.getLogger().println("Not a single-use slave, this is a " + computer.getClass());
}
}
示例4: onTemporarilyOffline
import hudson.slaves.OfflineCause; //导入依赖的package包/类
@Override
public void onTemporarilyOffline(Computer c, OfflineCause cause) {
// fired when master or slave goes into temporary offline state
logger.info("---- " + ComputerListenerImpl.class.getName() + ":"
+ " onTemporarilyOffline computer " + c);
// update functions only when gearman-plugin is enabled
if (!GearmanPluginConfig.get().enablePlugin()) {
return;
}
// re-register gearman functions on node status change,
GearmanProxy.getInstance().registerJobs();
}
示例5: superMarkOffline
import hudson.slaves.OfflineCause; //导入依赖的package包/类
public boolean superMarkOffline(Computer c, OfflineCause oc) {
return super.markOffline(c, oc);
}