Put the node offline on a model

@param c the model
@return {@code true} if the node was online and is set offline. {@code false} otherwise
320185
@Override
    public boolean applyAction(Model c) {
        Mapping map = c.getMapping();
        return !map.isOffline(node) && map.addOfflineNode(node);
    }
1200034
public static void closeEL(Closeable c) {
	try {
	    if (c != null) c.close();
	}
	// catch (AlwaysThrow at) {throw at;}
	catch (Throwable e) {
	    ExceptionUtil.rethrowIfNecessary(e);
	}
    }
1144847
function(cb) {
    // If we're inside phonegap use its event.
    if (window.phonegap) {
      return document.addEventListener("offline", cb, false);
    } else if (window.addEventListener) {
      // With the offline HTML5 event from the window
      this.addLocalEventListener(window, "offline", cb);
    } else {
      /*
      Works in IE with the Work Offline option in the 
      File menu and pulling the ethernet cable
      Ref: http://robertnyman.com/html5/offline/online-offline-events.html
    */
      document.body.onoffline = cb;
    }
  }
57360
@Override
    public boolean applyAction(Model m) {
        Mapping map = m.getMapping();
        if (map.isOnline(node) &&
                map.isRunning(vm) &&
                map.getVMLocation(vm).equals(node)) {
            map.addReadyVM(vm);
            return true;
        }
        return false;
    }
1342412
public boolean request(String nodeId, String message) {
        if (!channelAvailable(nodeId)) {
            try {
                lazyInit(nodeId);
            } catch (ApplicationInstanceOfflineException nodeOffline) {
                LOG.warn("Warning, node is offline.", nodeOffline);
                return false;
            } catch (Exception e) {
                LOG.error("Error, unexpected exception.", e);
                return false;
            }
        }
        if (LOG.isDebugEnabled())
            LOG.debug(String.format(">>>> rpc to %s  >>> remoteAddress=%s", nodeId, nodeId_to_connectedChannel_map.get(nodeId).remoteAddress()));
        nodeId_to_connectedChannel_map.get(nodeId).writeAndFlush(message + Constant.RPC_DELIMITER);
        return true;
    }
534573
public static boolean isOutOfBandNode (@Nonnull final IHCNode aHCNode)
  {
    ValueEnforcer.notNull (aHCNode, "HCNode");

    // Is the @OutOfBandNode annotation present?
    if (s_aOOBNAnnotationCache.hasAnnotation (aHCNode))
      return true;

    // If it is a wrapped node, look into it
    if (HCHelper.isWrappedNode (aHCNode))
      return isOutOfBandNode (HCHelper.getUnwrappedNode (aHCNode));

    // Not an out of band node
    return false;
  }
978588
public boolean isOnline(String nodeID) {
		if (this.nodeID.equals(nodeID)) {
			return true;
		}
		NodeDescriptor node = nodes.get(nodeID);
		if (node == null) {
			return false;
		}
		node.readLock.lock();
		try {
			return node.offlineSince == 0 && node.seq > 0;
		} finally {
			node.readLock.unlock();
		}
	}
666648
public boolean markAsOffline() {
		if (offlineSince == 0) {
			offlineSince = System.currentTimeMillis();
			seq++;
			info.put("seq", seq);
			return true;
		}
		return false;
	}
232252
public static void closeWithWarning(Closeable c) {
        if (c != null) {
            try {
                c.close();
            } catch (IOException e) {
                LOG.warning("Caught exception during close(): " + e);
            }
        }
    }
539592
public synchronized boolean disableNode(final String jvmRoute) {
        final Node node = nodes.get(jvmRoute);
        if (node != null) {
            for (final Context context : node.getContexts()) {
                context.disable();
            }
            return true;
        }
        return false;
    }
1084574
function reportIfUnreachable(node) {
				if (currentCodePath.currentSegments.every(isUnreachable)) {
					context.report(node, ProblemMessages['no-unreachable']);
				}
			}
45784
protected void setNode(Node node) {
        assert node!=null;
        if(node instanceof Slave)
            this.nodeName = node.getNodeName();
        else
            this.nodeName = null;

        setNumExecutors(node.getNumExecutors());
        if (this.temporarilyOffline) {
            // When we get a new node, push our current temp offline
            // status to it (as the status is not carried across
            // configuration changes that recreate the node).
            // Since this is also called the very first time this
            // Computer is created, avoid pushing an empty status
            // as that could overwrite any status that the Node
            // brought along from its persisted config data.
            node.setTemporaryOfflineCause(this.offlineCause);
        }
    }
873397
public boolean isInClosedList(long ref) {
        if (m_nodePool == null) {
            return false;
        }
        for (Node n : m_nodePool.findNodes(ref)) {
            if ((n.flags & DT_NODE_CLOSED) != 0) {
                return true;
            }
        }
        return false;
    }
566181
public boolean remove(Node<E> e) {

        mPutLock.lock();
        mPollLock.lock();
        try {
            if (e == null)
                return false;
    
            if (e.mRemoved)
                return false;
    
            if (mSize.get() == 0)
                return false;

            if (e == mTail) {
                removeTail();
                return true;
            }
            if (e == mHead.mNext) {
                removeHead();
                return true;
            }
            if (mSize.get() < 3)
                return false;

            if (e.mPrev == null || e.mNext == null)
                return false;

            e.mPrev.mNext = e.mNext;
            e.mNext.mPrev = e.mPrev;
            e.mRemoved = true;
            mSize.decrementAndGet();
            mNodePool.returnNode(e);
            return true;
        }
        finally {
            mPollLock.unlock();
            mPutLock.unlock();
        }
    }
210655
protected void offlineCacheRemove(CmsResource resource) {

        for (CachePair cachePair : m_caches) {
            try {
                cachePair.getOfflineCache().remove(resource);
            } catch (Throwable e) {
                LOG.error(e.getLocalizedMessage());
            }
        }
    }
1166794
private boolean isAllSuitableNodesOffline(R build) {
        Label label = getAssignedLabel();
        List<Node> allNodes = Jenkins.getInstance().getNodes();

        if (label != null) {
            //Invalid label. Put in queue to make administrator fix
            if(label.getNodes().isEmpty()) {
                return false;
            }
            //Returns true, if all suitable nodes are offline
            return label.isOffline();
        } else {
            if(canRoam) {
                for (Node n : Jenkins.getInstance().getNodes()) {
                    Computer c = n.toComputer();
                    if (c != null && c.isOnline() && c.isAcceptingTasks() && n.getMode() == Mode.NORMAL) {
                        // Some executor is online that  is ready and this job can run anywhere
                        return false;
                    }
                }
                //We can roam, check that the master is set to be used as much as possible, and not tied jobs only.
                return Jenkins.getInstance().getMode() == Mode.EXCLUSIVE;
            }
        }
        return true;
    }
721017
@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;
    }