for (ComputerListener cl : ComputerListener.all()) { try { cl.onConfigurationChange(); } catch (Throwable t) { LOGGER.log(Level.WARNING, null, t);
/** * Marks the computer as temporarily offline. This retains the underlying * {@link Channel} connection, but prevent builds from executing. * * @param cause * If the first argument is true, specify the reason why the node is being put * offline. */ public void setTemporarilyOffline(boolean temporarilyOffline, OfflineCause cause) { offlineCause = temporarilyOffline ? cause : null; this.temporarilyOffline = temporarilyOffline; Node node = getNode(); if (node != null) { node.setTemporaryOfflineCause(offlineCause); } synchronized (statusChangeLock) { statusChangeLock.notifyAll(); } for (ComputerListener cl : ComputerListener.all()) { if (temporarilyOffline) cl.onTemporarilyOffline(this,cause); else cl.onTemporarilyOnline(this); } }
/** * Called right after a {@link Computer} comes online. * * <p> * This enables you to do some work on all the agents * as they get connected. * * <p> * Starting Hudson 1.312, this method is also invoked for the master, not just for agents. * * @param listener * This is connected to the launch log of the computer or Jenkins master. * Since this method is called synchronously from the thread * that launches a computer, if this method performs a time-consuming * operation, this listener should be notified of the progress. * This is also a good listener for reporting problems. * * @throws IOException * Exceptions will be recorded to the listener. Note that * throwing an exception doesn't put the computer offline. * @throws InterruptedException * Exceptions will be recorded to the listener. Note that * throwing an exception doesn't put the computer offline. * * @see #preOnline(Computer, Channel, FilePath, TaskListener) */ public void onOnline(Computer c, TaskListener listener) throws IOException, InterruptedException { // compatibility onOnline(c); }
/** * Registers this {@link ComputerListener} so that it will start receiving events. * * @deprecated as of 1.286 * put {@link Extension} on your class to have it auto-registered. */ @Deprecated public final void register() { all().add(this); }
/** * Create a new slave on the local host and wait for it to come online * before returning */ public DumbSlave createOnlineSlave(Label l, EnvVars env) throws Exception { final CountDownLatch latch = new CountDownLatch(1); ComputerListener waiter = new ComputerListener() { @Override public void onOnline(Computer C, TaskListener t) { latch.countDown(); unregister(); } }; waiter.register(); DumbSlave s = createSlave(l, env); latch.await(); return s; }
/** * Called right after a {@link Computer} went offline. * * @since 1.571 */ public void onOffline(@Nonnull Computer c, @CheckForNull OfflineCause cause) { onOffline(c); }
public void superPreOnline(Computer c, Channel channel, FilePath root, TaskListener listener) throws IOException, InterruptedException { super.preOnline(c, channel, root, listener); }
public void superOnConfigurationChange() { super.onConfigurationChange(); }
public void superOnTemporarilyOnline(Computer c) { super.onTemporarilyOnline(c); }
public void superOnTemporarilyOffline(Computer c, OfflineCause cause) { super.onTemporarilyOffline(c, cause); }
public void superOnOnline(Computer c, TaskListener listener) throws IOException, InterruptedException { super.onOnline(c, listener); }
/** * Unregisters this {@link ComputerListener} so that it will never receive further events. * * <p> * Unless {@link ComputerListener} is unregistered, it will never be a subject of GC. */ public final boolean unregister() { return all().remove(this); }
/** * Marks the computer as temporarily offline. This retains the underlying * {@link Channel} connection, but prevent builds from executing. * * @param cause * If the first argument is true, specify the reason why the node is being put * offline. */ public void setTemporarilyOffline(boolean temporarilyOffline, OfflineCause cause) { offlineCause = temporarilyOffline ? cause : null; this.temporarilyOffline = temporarilyOffline; Node node = getNode(); if (node != null) { node.setTemporaryOfflineCause(offlineCause); } synchronized (statusChangeLock) { statusChangeLock.notifyAll(); } for (ComputerListener cl : ComputerListener.all()) { if (temporarilyOffline) cl.onTemporarilyOffline(this,cause); else cl.onTemporarilyOnline(this); } }
/** * Create a new slave on the local host and wait for it to come online * before returning */ public DumbSlave createOnlineSlave(Label l, EnvVars env) throws Exception { final CountDownLatch latch = new CountDownLatch(1); ComputerListener waiter = new ComputerListener() { @Override public void onOnline(Computer C, TaskListener t) { latch.countDown(); unregister(); } }; waiter.register(); DumbSlave s = createSlave(l, env); latch.await(); return s; }
public void superOnOffline(Computer c) { super.onOffline(c); }
@Override public void preOnline(Computer c, Channel channel, FilePath root, TaskListener listener) throws IOException, InterruptedException { initPython(); if (pexec.isImplemented(2)) { pexec.execPythonVoid("pre_online", c, channel, root, listener); } else { super.preOnline(c, channel, root, listener); } }