@Override public boolean apply(GridNode n) { return containsIp(n.addresses(), ip); } });
/** * Returns tha list of resolved inet addresses. First addresses are resolved by host names, * if this attempt fails then the addresses are resolved by ip addresses. * * @param node Grid node. * @return Inet addresses for given addresses and host names. * @throws GridException If non of addresses can be resolved. */ public static Collection<InetAddress> toInetAddresses(GridNode node) throws GridException { return toInetAddresses(node.addresses(), node.hostNames()); }
/** * Returns tha list of resolved socket addresses. First addresses are resolved by host names, * if this attempt fails then the addresses are resolved by ip addresses. * * @param node Grid node. * @param port Port. * @return Socket addresses for given addresses and host names. */ public static Collection<InetSocketAddress> toSocketAddresses(GridNode node, int port) { return toSocketAddresses(node.addresses(), node.hostNames(), port); }
/** * Returns string representation of node addresses. * * @param node Grid node. * @return String representation of addresses. */ public static String addressesAsString(GridNode node) { return addressesAsString(node.addresses(), node.hostNames()); }
names.addAll(node.addresses());
names.addAll(node.addresses());
/** * Short node representation. * * @param n Grid node. * @return Short string representing the node. */ public static String toShortString(GridNode n) { return "GridNode [id=" + n.id() + ", order=" + n.order() + ", addr=" + n.addresses() + ", daemon=" + n.isDaemon() + ']'; }
/** {@inheritDoc} */ @Override public GridSecurityContext authenticateNode(GridNode node, GridSecurityCredentials cred) throws GridException { GridSecuritySubjectAdapter s = new GridSecuritySubjectAdapter(GridSecuritySubjectType.REMOTE_NODE, node.id()); s.address(new InetSocketAddress(F.first(node.addresses()), 0)); s.permissions(ALLOW_ALL); return new GridSecurityContext(s); }
/** {@inheritDoc} */ @Override public boolean pingNodeByAddress(String host) { guard(); try { for (GridNode n : nodes()) if (n.addresses().contains(host)) return ctx.discovery().pingNode(n.id()); return false; } finally { unguard(); } }
/** {@inheritDoc} */ @Override public String shortDisplay() { return name() + ": id8=" + U.id8(evtNode.id()) + ", ip=" + F.first(evtNode.addresses()); }
String addr = F.first(node.addresses());
if (ip != null && node != null && !containsIp(node.addresses(), ip)) node = null;