Source:
<code>private void restoreNodes(NodeSource nodeSource) { int lookUpTimeout = PAResourceManagerProperties.RM_NODELOOKUP_TIMEOUT.getValueAsInt(); String nodeSourceName = nodeSource.getName(); int nodesCount = nodeSource.getNodesCount(); if (nodesCount != 0) { logger.warn("Recovered node source " + nodeSourceName + " unexpectedly already has nodes registered."); } Collection<RMNodeData> nodesData = dbManager.getNodesByNodeSource(nodeSourceName); logger.info("Number of nodes to recover for the node source " + nodeSourceName + ": " + nodesData.size()); for (RMNodeData rmNodeData : nodesData) { String nodeUrl = rmNodeData.getNodeUrl(); RMNode rmnode = null; Node node = null; try { logger.info("Trying to lookup a node to recover: " + nodeUrl); node = nodeSource.lookupNode(nodeUrl, lookUpTimeout); } catch (Exception e) { logger.warn("Node to recover could not be looked up at URL: " + nodeUrl, e); node = null; } if (node != null) { if (rmNodeData.equalsToNode(node)) { logger.info("Node to recover could successfully be looked up at URL: " + nodeUrl); rmnode = nodeSource.internalAddNodeAfterRecovery(node, rmNodeData); this.allNodes.put(rmnode.getNodeURL(), rmnode); } else { logger.warn("The node that has been looked up does not have the same information as the node to recover: " + node.getNodeInformation().getName() + " is not equal to " + rmNodeData.getName() + " or " + node.getNodeInformation().getURL() + " is not equal to " + <START> rmNodeData.getNodeUrl()); <END> } } else { if (!rmNodeData.getState().equals(NodeState.DEPLOYING)) { nodeSource.detectedPingedDownNode(rmNodeData.getName(), nodeUrl); } } if (isEligible(rmnode)) { eligibleNodes.add(rmnode); } } }</code><technical_language>put this for a private method (From I works solely local variables, for, class state). this method more readable shorter name of private method for a good description</technical_language>

Target:
private void restoreNodes(NodeSource nodeSource) { logger.info("Start to recover nodes"); int lookUpTimeout = PAResourceManagerProperties.RM_NODELOOKUP_TIMEOUT.getValueAsInt(); String nodeSourceName = nodeSource.getName(); makeSureNodeSourceHasNoNode(nodeSource, nodeSourceName); Collection<RMNodeData> nodesData = dbManager.getNodesByNodeSource(nodeSourceName); logger.info("Number of nodes found in database for node source " + nodeSourceName + ": " + nodesData.size()); Map<NodeState, Integer> nodeStates = new HashMap<>(); int totalEligibleRecoveredNodes = 0; for (RMNodeData rmNodeData : nodesData) { String nodeUrl = rmNodeData.getNodeUrl(); RMNode rmnode = null; Node node = tryToLookupNode(nodeSource, lookUpTimeout, nodeUrl); if (node != null) { rmnode = restoreInternalNode(nodeSource, rmNodeData, nodeUrl, node); nodesRecoveryManager.restoreLocks(rmnode, rmNodeData.getProvider()); Integer nbNodesInState = nodeStates.get(rmnode.getState()); int newNbNodesInState = nbNodesInState == null ? 1 : nbNodesInState + 1; nodeStates.put(rmnode.getState(), newNbNodesInState); } else { dbManager.removeNode(rmNodeData); triggerDownNodeHandling(nodeSource, rmNodeData, nodeUrl); } if (isEligible(rmnode)) { eligibleNodes.add(rmnode); totalEligibleRecoveredNodes++; } } int totalRecoveredNodes = 0; logger.info("Recovered nodes:"); for (Entry<NodeState, Integer> nodeStateIntEntry : nodeStates.entrySet()) { logger.info("- nodes in " + nodeStateIntEntry.getKey() + " state: " + nodeStateIntEntry.getValue()); totalRecoveredNodes += nodeStateIntEntry.getValue(); } logger.info("Total number of nodes recovered: " + totalRecoveredNodes + ", including eligible nodes: " + totalEligibleRecoveredNodes); logger.info("End of nodes recovery"); }