Java Code Examples for hudson.slaves.AbstractCloudComputer#getNode()
The following examples show how to use
hudson.slaves.AbstractCloudComputer#getNode() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DockerCloudRetentionStrategy.java From yet-another-docker-plugin with MIT License | 6 votes |
/** * While x-stream serialisation buggy, copy implementation. */ @Override @GuardedBy("hudson.model.Queue.lock") public long check(final AbstractCloudComputer c) { final AbstractCloudSlave computerNode = c.getNode(); if (c.isIdle() && computerNode != null) { final long idleMilliseconds = System.currentTimeMillis() - c.getIdleStartMilliseconds(); if (idleMilliseconds > MINUTES.toMillis(idleMinutes)) { LOG.info("Disconnecting {}, after {} min timeout.", c.getName(), idleMinutes); try { computerNode.terminate(); } catch (InterruptedException | IOException e) { LOG.warn("Failed to terminate {}", c.getName(), e); } } } return 1; }
Example 2
Source File: DockerOnceRetentionStrategy.java From yet-another-docker-plugin with MIT License | 5 votes |
@Override public void start(AbstractCloudComputer c) { if (c.getNode() instanceof EphemeralNode) { throw new IllegalStateException("May not use OnceRetentionStrategy on an EphemeralNode: " + c); } super.start(c); }