Return the nodeId for the given socket address. Returns <code>null</code>
if the socket address is not known.
@throws IllegalArgumentException thrown when the socketAddress is <code>null</code> or not registered with this {@link MemcachedNodesManager}.
320074
@Nonnull
	public String getNodeId(final InetSocketAddress socketAddress) throws IllegalArgumentException {
		if ( socketAddress == null ) {
			throw new IllegalArgumentException("SocketAddress must not be null.");
		}
		final String result = _address2Ids.get( socketAddress );
		if ( result == null ) {
			throw new IllegalArgumentException("SocketAddress " + socketAddress + " not known (registered addresses: " + _address2Ids.keySet() + ").");
		}
		return result;
	}
412253
public Node nodeBy(final NetworkAddress hostname) {
        if (hostname == null) {
            return null;
        }

        for (Node node : nodes) {
            if (node.hostname().equals(hostname)) {
                return node;
            }
        }
        return null;
    }
4084
public InetSocketAddress getRemoteAddressTCP () {
		SocketChannel socketChannel = tcp.socketChannel;
		if (socketChannel != null) {
			Socket socket = tcp.socketChannel.socket();
			if (socket != null) {
				return (InetSocketAddress)socket.getRemoteSocketAddress();
			}
		}
		return null;
	}
1256621
@Override
  public InetSocketAddress ipRemote()
  {
    SocketChannel s = _channel;
    
    if (s != null) {
      try {
        return (InetSocketAddress) s.getRemoteAddress();
      } catch (IOException e) {
        return null;
        //throw new RuntimeException(e);
      }
    }
    else {
      return null;
    }
  }
98813
@SuppressWarnings("unchecked")
    private final int checkNodeDirectory() throws ClusterInfoException {
        try {

            // get all of the nodes in the nodeDir and set one for this node if it's not already set.
            final Collection<String> nodeDirs;
            if (nodeDirectory == null) {
                nodeDirectory = utils.session.recursiveMkdir(utils.nodesDir + "/node_", thisNode, DirMode.PERSISTENT,
                        DirMode.EPHEMERAL_SEQUENTIAL);
                nodeDirs = session.getSubdirs(utils.nodesDir, this);
            } else
                nodeDirs = utils.persistentGetSubdir(utils.nodesDir, null);

            // what node am I?
            int nodeRank = -1;
            int index = 0;
            final String nodeSubdir = new File(nodeDirectory).getName();
            for (final String cur : nodeDirs) {
                if (nodeSubdir.equals(cur)) {
                    nodeRank = index;
                    break;
                }
                index++;
            }

            // If I couldn't find me, there's a problem.
            if (nodeRank == -1) {
                // drop the node directory since it clearly doesn't exist anymore
                nodeDirectory = null;
                throw new ClusterInfoException(
                        "Node " + thisNode + " was registered at " + nodeSubdir + " but it wasn't found as a subdirectory.");
            }

            // verify the container address is correct.
            C curDest = (C) session.getData(nodeDirectory, null);
            if (curDest == null) // this really can't be null
                session.setData(nodeDirectory, thisNode);
            else if (!thisNode.equals(curDest)) { // wth?
                final String tmp = nodeDirectory;
                nodeDirectory = null;
                throw new ClusterInfoException("Impossible! The Node directory " + tmp + " contains the destination for " + curDest
                        + " but should have " + thisNode);
            }

            // Check to make sure that THIS node is only in one place. If we find it in a node directory
            // that's not THIS node directory then this is something we should clean up.
            for (final String subdir : nodeDirs) {
                final String fullPathToSubdir = utils.nodesDir + "/" + subdir;
                curDest = (C) session.getData(fullPathToSubdir, null);
                if (thisNode.equals(curDest) && !fullPathToSubdir.equals(nodeDirectory)) // this is bad .. clean up
                    session.rmdir(fullPathToSubdir);
            }

            return nodeRank;
        } catch (final ClusterInfoException cie) {
            cleanupAfterExceptionDuringNodeDirCheck();
            throw cie;
        } catch (final RuntimeException re) {
            cleanupAfterExceptionDuringNodeDirCheck();
            throw re;
        } catch (final Throwable th) {
            cleanupAfterExceptionDuringNodeDirCheck();
            throw new RuntimeException("Unknown exception!", th);
        }
    }
145003
@Nullable
  public static IMicroNode getAsNode (@Nonnull final IHCNode aHCNode)
  {
    return getAsNode (aHCNode, HCSettings.getConversionSettings ());
  }
929920
SocketAddress getRemoteSocketAddress() {
        // a lot could go wrong here, so rather than put in a bunch of code
        // to check for nulls all down the chain let's do it the simple
        // yet bulletproof way
        try {
            return ((SocketChannel) sendThread.sockKey.channel()).socket()
                    .getRemoteSocketAddress();
        } catch (NullPointerException e) {
            return null;
        }
    }
2693
public int getSubnetwork(int nodeId) {
        byte[] bytes = new byte[1];
        da.getBytes(nodeId, bytes, bytes.length);

        return (int) bytes[0];
    }
1300024
public String getMemcachedNodeId() {
        final String nodeId = _nodeIds.get( _random.nextInt( _nodeIds.size() ) );
        return isNodeAvailable( nodeId ) ? nodeId : getAvailableNodeId( nodeId );
    }
1303681
public final Map<String, String> stats(InetSocketAddress address)
      throws MemcachedException, InterruptedException, TimeoutException {
    return this.stats(address, this.opTimeout);
  }
980966
public Long getPrimarySsId(String address, boolean sync) throws IOException,
      KeeperException, InterruptedException, ClassNotFoundException {
    Stat stat = new Stat();
    String node = getSsIdNode(address);
    byte[] data = getNodeData(node, stat, false, sync);
    if (data == null) {
      return null;
    }
    return (Long) SerializableUtils.getFromBytes(data, Long.class);
  }
212523
public static InetAddress
    getByAddress(String addr) throws UnknownHostException {
        byte[] bytes;
        bytes = toByteArray(addr, IPv4);
        if (bytes != null)
            return InetAddress.getByAddress(bytes);
        bytes = toByteArray(addr, IPv6);
        if (bytes != null)
            return InetAddress.getByAddress(bytes);
        throw new UnknownHostException("Invalid address: " + addr);
    }
387840
private Node findNode(String id) {
        Node result = doFindNode(id);
        if (result != null) {
            return result;
        }
        throw new IllegalArgumentException("Couldn't find node " + id);
    }
693887
def getNode(self, address):
        
        try:
            for node in self.config['nodes']:
                if node['address'] == address:
                    return node
            return False
        except KeyError:
            LOGGER.error('Usually means we have not received the config yet.', exc_info=True)
            return False
773801
static InetSocketAddress getNameNodeAddress(Configuration conf,
                                                      String cname, String rpcKey, String cname2) {
    String fs = conf.get(cname);
    String fs1 = conf.get(rpcKey);
    String fs2 = conf.get(cname2);
    Configuration newconf = new Configuration(conf);
    newconf.set("fs.default.name", fs);
    if (fs1 != null) {
      newconf.set(DFS_NAMENODE_RPC_ADDRESS_KEY, fs1);
    }
    if (fs2 != null) {
      newconf.set("dfs.namenode.dn-address", fs2);
    }
    return DataNode.getNameNodeAddress(newconf);
  }
124884
@SuppressWarnings("unchecked")
	public Address getClusterNodeAddress(ClusteredCacheData cacheData) {
		return (Address) cacheData.getNode().get(CLUSTER_NODE_ADDRESS_NODE_KEY);
	}
133646
public InetAddress
getAddress() {
	try {
		if (name == null)
			return InetAddress.getByAddress(address);
		else
			return InetAddress.getByAddress(name.toString(),
							address);
	} catch (UnknownHostException e) {
		return null;
	}
}