@Override public Future<?> disconnect(OfflineCause cause) { super.disconnect(cause); return Computer.threadPoolForRemoting.submit(new Runnable() { public void run() { // do this on another thread so that any lengthy disconnect operation // (which could be typical) won't block UI thread. launcher.beforeDisconnect(SlaveComputer.this, taskListener); closeChannel(); launcher.afterDisconnect(SlaveComputer.this, taskListener); } }); }
/** * @deprecated Implementation of CLI command "disconnect-node" moved to {@link hudson.cli.DisconnectNodeCommand}. * * @param cause * Record the note about why you are disconnecting this node */ @Deprecated public void cliDisconnect(String cause) throws ExecutionException, InterruptedException { checkPermission(DISCONNECT); disconnect(new ByCLI(cause)).get(); }
@Override public void run() { for( Computer c : computers.values() ) { try { c.interrupt(); killComputer(c); pending.add(c.disconnect(null)); } catch (OutOfMemoryError e) { // we should just propagate this, no point trying to log throw e; } catch (LinkageError e) { LOGGER.log(Level.WARNING, "Could not disconnect " + c + ": " + e.getMessage(), e); // safe to ignore and continue for this one } catch (Throwable e) { LOGGER.log(Level.WARNING, "Could not disconnect " + c + ": " + e.getMessage(), e); // save for later errors.add(e); } } } });
/** * Equivalent to {@code disconnect(null)} * * @deprecated as of 1.320. * Use {@link #disconnect(OfflineCause)} and specify the cause. */ @Deprecated public Future<?> disconnect() { recordTermination(); if (Util.isOverridden(Computer.class,getClass(),"disconnect",OfflineCause.class)) // if the subtype already derives disconnect(OfflineCause), delegate to it return disconnect(null); connectTime=0; return Futures.precomputed(null); }
/** * Disconnect this computer. * * If this is the master, no-op. This method may return immediately * while the launch operation happens asynchronously. * * @param cause * Object that identifies the reason the node was disconnected. * * @return * {@link Future} to track the asynchronous disconnect operation. * @see #connect(boolean) * @since 1.320 */ public Future<?> disconnect(OfflineCause cause) { recordTermination(); offlineCause = cause; if (Util.isOverridden(Computer.class,getClass(),"disconnect")) return disconnect(); // legacy subtypes that extend disconnect(). connectTime=0; return Futures.precomputed(null); }
@Override protected Map<Computer, Data> monitor() throws InterruptedException { Result<Data> base = monitorDetailed(); Map<Computer, Data> monitoringData = base.getMonitoringData(); for (Entry<Computer, Data> e : monitoringData.entrySet()) { Computer c = e.getKey(); Data d = e.getValue(); if (base.getSkipped().contains(c)) { assert d == null; continue; } if (d ==null) { // if we failed to monitor, put in the special value that indicates a failure e.setValue(d=new Data(get(c),-1L)); } if(d.hasTooManyTimeouts() && !isIgnored()) { // unlike other monitors whose failure still allow us to communicate with the agent, // the failure in this monitor indicates that we are just unable to make any requests // to this agent. So we should severe the connection, as opposed to marking it temporarily // off line, which still keeps the underlying channel open. c.disconnect(d); LOGGER.warning(Messages.ResponseTimeMonitor_MarkedOffline(c.getName())); } } return monitoringData; }
@Override public void run() { Computer c = node.toComputer(); if (c != null) { c.recordTermination(); c.disconnect(OfflineCause.create(hudson.model.Messages._Hudson_NodeBeingRemoved())); } if (node == nodes.remove(node.getNodeName())) { jenkins.updateComputerList(); jenkins.trimLabels(); } } });
protected void execute(TaskListener listener) throws IOException, InterruptedException { if (!enabled) return; long now = System.currentTimeMillis(); for (Computer c: Jenkins.get().getComputers()) { VirtualChannel ch = c.getChannel(); if (ch instanceof Channel) { Channel channel = (Channel) ch; if (now-channel.getLastHeard() > TIME_TILL_PING) { // haven't heard from this agent for a while. Long lastPing = (Long)channel.getProperty(ConnectionActivityMonitor.class); if (lastPing!=null && now-lastPing > TIMEOUT) { LOGGER.info("Repeated ping attempts failed on "+c.getName()+". Disconnecting"); c.disconnect(OfflineCause.create(Messages._ConnectionActivityMonitor_OfflineCause())); } else { // send a ping. if we receive a reply, it will be reflected in the next getLastHeard() call. channel.callAsync(PING_COMMAND); if (lastPing==null) channel.setProperty(ConnectionActivityMonitor.class,now); } } else { // we are receiving data nicely channel.setProperty(ConnectionActivityMonitor.class,null); } } } }
@Override public Future<?> disconnect(OfflineCause cause) { super.disconnect(cause); return Computer.threadPoolForRemoting.submit(new Runnable() { public void run() { // do this on another thread so that any lengthy disconnect operation // (which could be typical) won't block UI thread. launcher.beforeDisconnect(SlaveComputer.this, taskListener); closeChannel(); launcher.afterDisconnect(SlaveComputer.this, taskListener); } }); }
@Override public Future<?> disconnect(OfflineCause cause) { super.disconnect(cause); return Computer.threadPoolForRemoting.submit(new Runnable() { public void run() { // do this on another thread so that any lengthy disconnect operation // (which could be typical) won't block UI thread. launcher.beforeDisconnect(SlaveComputer.this, taskListener); closeChannel(); launcher.afterDisconnect(SlaveComputer.this, taskListener); } }); }
/** * @deprecated Implementation of CLI command "disconnect-node" moved to {@link hudson.cli.DisconnectNodeCommand}. * * @param cause * Record the note about why you are disconnecting this node */ @Deprecated public void cliDisconnect(String cause) throws ExecutionException, InterruptedException { checkPermission(DISCONNECT); disconnect(new ByCLI(cause)).get(); }
/** * CLI command to disconnects this node. */ @CLIMethod(name="disconnect-node") public void cliDisconnect(@Option(name="-m",usage="Record the note about why you are disconnecting this node") String cause) throws ExecutionException, InterruptedException { checkPermission(Hudson.ADMINISTER); disconnect(new ByCLI(cause)).get(); }
/** * CLI command to disconnects this node. */ @CLIMethod(name="disconnect-node") public void cliDisconnect(@Option(name="-m",usage="Record the note about why you are disconnecting this node") String cause) throws ExecutionException, InterruptedException { checkPermission(Hudson.ADMINISTER); disconnect(new ByCLI(cause)).get(); }
/** * CLI command to disconnects this node. */ @CLIMethod(name="disconnect-node") public void cliDisconnect(@Option(name="-m",usage="Record the note about why you are disconnecting this node") String cause) throws ExecutionException, InterruptedException { checkPermission(Hudson.ADMINISTER); disconnect(new ByCLI(cause)).get(); }
/** * CLI command to disconnects this node. */ @CLIMethod(name = "disconnect-node") public void cliDisconnect(@Option(name = "-m", usage = "Record the note about why you are disconnecting this node") String cause) throws ExecutionException, InterruptedException { checkPermission(Hudson.ADMINISTER); disconnect(new ByCLI(cause)).get(); }
/** * Removes a {@link Node} from Hudson. */ public synchronized void removeNode(Node n) throws IOException { Computer c = n.toComputer(); if (c != null) { c.disconnect(OfflineCause.create(Messages._Hudson_NodeBeingRemoved())); } ArrayList<Node> nl = new ArrayList<Node>(this.slaves); nl.remove(n); setNodes(nl); }
/** * Removes a {@link Node} from Hudson. */ public synchronized void removeNode(Node n) throws IOException { Computer c = n.toComputer(); if (c != null) { c.disconnect(OfflineCause.create(Messages._Hudson_NodeBeingRemoved())); } ArrayList<Node> nl = new ArrayList<Node>(this.slaves); nl.remove(n); setNodes(nl); }
/** * Removes a {@link Node} from Hudson. */ public synchronized void removeNode(Node n) throws IOException { Computer c = n.toComputer(); if (c != null) { c.disconnect(OfflineCause.create(Messages._Hudson_NodeBeingRemoved())); } ArrayList<Node> nl = new ArrayList<Node>(this.slaves); nl.remove(n); setNodes(nl); }
/** * Removes a {@link Node} from Hudson. */ public synchronized void removeNode(Node n) throws IOException { Computer c = n.toComputer(); if (c != null) { c.disconnect(OfflineCause.create(Messages._Hudson_NodeBeingRemoved())); } ArrayList<Node> nl = new ArrayList<Node>(this.slaves); nl.remove(n); setNodes(nl); }
@Override public void run() { Computer c = node.toComputer(); if (c != null) { c.recordTermination(); c.disconnect(OfflineCause.create(hudson.model.Messages._Hudson_NodeBeingRemoved())); } if (node == nodes.remove(node.getNodeName())) { jenkins.updateComputerList(); jenkins.trimLabels(); } } });