Java Code Examples for hudson.model.Computer#getChannel()
The following examples show how to use
hudson.model.Computer#getChannel() .
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: WithMavenStepExecution2.java From pipeline-maven-plugin with MIT License | 5 votes |
/** * Gets the computer for the current launcher. * * @return the computer * @throws AbortException in case of error. */ @Nonnull private Computer getComputer() throws AbortException { if (computer != null) { return computer; } String node = null; Jenkins j = Jenkins.getInstance(); for (Computer c : j.getComputers()) { if (c.getChannel() == launcher.getChannel()) { node = c.getName(); break; } } if (node == null) { throw new AbortException("Could not find computer for the job"); } computer = j.getComputer(node); if (computer == null) { throw new AbortException("No such computer " + node); } if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Computer: {0}", computer.getName()); try { LOGGER.log(Level.FINE, "Env: {0}", computer.getEnvironment()); } catch (IOException | InterruptedException e) {// ignored } } return computer; }
Example 2
Source File: ChannelShutdownListener.java From jenkins-test-harness with MIT License | 5 votes |
@Override public synchronized void onOnline(Computer c, TaskListener listener) throws IOException, InterruptedException { VirtualChannel ch = c.getChannel(); if (ch instanceof Channel) { channels.add((Channel)ch); } }
Example 3
Source File: RemotingTest.java From git-client-plugin with MIT License | 5 votes |
/** * Makes sure {@link GitClient} is remotable. */ @Test public void testRemotability() throws Exception { DumbSlave agent = j.createSlave(); GitClient jgit = new JGitAPIImpl(tempFolder.getRoot(), StreamBuildListener.fromStdout()); Computer c = agent.toComputer(); c.connect(false).get(); VirtualChannel channel = c.getChannel(); channel.call(new Work(jgit)); channel.close(); }