/** * @param log Logger. * @param name Cache name. * @param cache Cache. * @param keyFactory Key factory. */ GridSpringCache(GridLogger log, String name, GridCacheProjection<?, ?> cache, GridClosure<Object, Object> keyFactory) { assert cache != null; this.log = log; this.name = name; this.cache = (GridCacheProjection<Object, Object>)cache; this.keyFactory = keyFactory != null ? keyFactory : F.identity(); }
/** * Returns only directly available nodes from given collection. * * @param nodes Nodes. * @return Directly available subset. */ protected static Collection<GridClientNode> selectDirectNodes(Collection<? extends GridClientNode> nodes) { return F.viewReadOnly(nodes, F.<GridClientNode>identity(), CONNECTABLE); } }
/** {@inheritDoc} */ @Override public Iterator<GridCacheEntry<K, V>> iterator() { return new GridCacheIterator<>(set, F.<GridCacheEntry<K, V>>identity(), filter); }
/** {@inheritDoc} */ @Override public GridIterator<GridUuid> iterator() { return F.iterator(Collections.singleton(this), F.<GridUuid>identity(), true); }
/** * 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 addrs Addresses. * @param hostNames Host names. * @param port Port. * @return Socket addresses for given addresses and host names. */ public static Collection<InetSocketAddress> toSocketAddresses(Collection<String> addrs, Collection<String> hostNames, int port) { List<InetSocketAddress> res = new ArrayList<>(addrs.size()); Iterator<String> hostNamesIt = hostNames.iterator(); for (String addr : addrs) { String hostName = hostNamesIt.hasNext() ? hostNamesIt.next() : null; if (!F.isEmpty(hostName)) { InetSocketAddress inetSockAddr = new InetSocketAddress(hostName, port); if (inetSockAddr.isUnresolved() || inetSockAddr.getAddress().isLoopbackAddress()) inetSockAddr = new InetSocketAddress(addr, port); res.add(inetSockAddr); } // Always append address because local and remote nodes may have the same hostname // therefore remote hostname will be always resolved to local address. res.add(new InetSocketAddress(addr, port)); } return F.viewListReadOnly(res, F.<InetSocketAddress>identity()); }
", hostNames=" + hostNames + ']'); return F.viewListReadOnly(res, F.<InetAddress>identity());
Collection<GridNode> top = F.viewReadOnly(rmts, F.<GridNode>identity(), F.and(F.notIn(processed), VISIBLE_NODES));