Search in sources :

Example 1 with GridDhtAssignmentFetchFuture

use of org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAssignmentFetchFuture in project ignite by apache.

the class CacheAffinitySharedManager method initAffinity.

/**
     * @param desc Cache descriptor.
     * @param aff Affinity.
     * @param fut Exchange future.
     * @param fetch Force fetch flag.
     * @throws IgniteCheckedException If failed.
     */
private void initAffinity(DynamicCacheDescriptor desc, GridAffinityAssignmentCache aff, GridDhtPartitionsExchangeFuture fut, boolean fetch) throws IgniteCheckedException {
    assert desc != null;
    if (!fetch && canCalculateAffinity(desc, aff, fut)) {
        List<List<ClusterNode>> assignment = aff.calculate(fut.topologyVersion(), fut.discoveryEvent(), fut.discoCache());
        aff.initialize(fut.topologyVersion(), assignment);
    } else {
        GridDhtAssignmentFetchFuture fetchFut = new GridDhtAssignmentFetchFuture(cctx, desc, fut.topologyVersion(), fut.discoCache());
        fetchFut.init();
        fetchAffinity(fut, aff, fetchFut);
    }
}
Also used : GridDhtAssignmentFetchFuture(org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAssignmentFetchFuture) ArrayList(java.util.ArrayList) List(java.util.List)

Example 2 with GridDhtAssignmentFetchFuture

use of org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAssignmentFetchFuture in project ignite by apache.

the class CacheAffinitySharedManager method initCoordinatorCaches.

/**
     * @param fut Exchange future.
     * @throws IgniteCheckedException If failed.
     * @return Future completed when caches initialization is done.
     */
private IgniteInternalFuture<?> initCoordinatorCaches(final GridDhtPartitionsExchangeFuture fut) throws IgniteCheckedException {
    final List<IgniteInternalFuture<AffinityTopologyVersion>> futs = new ArrayList<>();
    forAllRegisteredCaches(new IgniteInClosureX<DynamicCacheDescriptor>() {

        @Override
        public void applyx(DynamicCacheDescriptor desc) throws IgniteCheckedException {
            CacheHolder cache = caches.get(desc.cacheId());
            if (cache != null) {
                if (cache.client())
                    cache.affinity().calculate(fut.topologyVersion(), fut.discoveryEvent(), fut.discoCache());
                return;
            }
            final Integer cacheId = desc.cacheId();
            GridCacheContext cacheCtx = cctx.cacheContext(cacheId);
            if (cacheCtx == null) {
                cctx.io().addHandler(desc.cacheId(), GridDhtAffinityAssignmentResponse.class, new IgniteBiInClosure<UUID, GridDhtAffinityAssignmentResponse>() {

                    @Override
                    public void apply(UUID nodeId, GridDhtAffinityAssignmentResponse res) {
                        processAffinityAssignmentResponse(nodeId, res);
                    }
                });
                cache = CacheHolder2.create(cctx, desc, fut, null);
                final GridAffinityAssignmentCache aff = cache.affinity();
                List<GridDhtPartitionsExchangeFuture> exchFuts = cctx.exchange().exchangeFutures();
                int idx = exchFuts.indexOf(fut);
                assert idx >= 0 && idx < exchFuts.size() - 1 : "Invalid exchange futures state [cur=" + idx + ", total=" + exchFuts.size() + ']';
                final GridDhtPartitionsExchangeFuture prev = exchFuts.get(idx + 1);
                if (log.isDebugEnabled()) {
                    log.debug("Need initialize affinity on coordinator [" + "cache=" + desc.cacheConfiguration().getName() + "prevAff=" + prev.topologyVersion() + ']');
                }
                assert prev.topologyVersion().compareTo(fut.topologyVersion()) < 0 : prev;
                GridDhtAssignmentFetchFuture fetchFut = new GridDhtAssignmentFetchFuture(cctx, desc, prev.topologyVersion(), prev.discoCache());
                fetchFut.init();
                final GridFutureAdapter<AffinityTopologyVersion> affFut = new GridFutureAdapter<>();
                fetchFut.listen(new IgniteInClosureX<IgniteInternalFuture<GridDhtAffinityAssignmentResponse>>() {

                    @Override
                    public void applyx(IgniteInternalFuture<GridDhtAffinityAssignmentResponse> fetchFut) throws IgniteCheckedException {
                        fetchAffinity(prev, aff, (GridDhtAssignmentFetchFuture) fetchFut);
                        aff.calculate(fut.topologyVersion(), fut.discoveryEvent(), fut.discoCache());
                        affFut.onDone(fut.topologyVersion());
                    }
                });
                futs.add(affFut);
            } else
                cache = new CacheHolder1(cacheCtx, null);
            CacheHolder old = caches.put(cache.cacheId(), cache);
            assert old == null : old;
        }
    });
    if (!futs.isEmpty()) {
        GridCompoundFuture<AffinityTopologyVersion, ?> affFut = new GridCompoundFuture<>();
        for (IgniteInternalFuture<AffinityTopologyVersion> f : futs) affFut.add(f);
        affFut.markInitialized();
        return affFut;
    }
    return null;
}
Also used : ArrayList(java.util.ArrayList) IgniteBiInClosure(org.apache.ignite.lang.IgniteBiInClosure) IgniteInternalFuture(org.apache.ignite.internal.IgniteInternalFuture) IgniteInClosureX(org.apache.ignite.internal.util.lang.IgniteInClosureX) GridCompoundFuture(org.apache.ignite.internal.util.future.GridCompoundFuture) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) GridAffinityAssignmentCache(org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentCache) GridFutureAdapter(org.apache.ignite.internal.util.future.GridFutureAdapter) GridDhtAssignmentFetchFuture(org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAssignmentFetchFuture) ArrayList(java.util.ArrayList) List(java.util.List) UUID(java.util.UUID) GridDhtPartitionsExchangeFuture(org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture) AffinityTopologyVersion(org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion) GridDhtAffinityAssignmentResponse(org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffinityAssignmentResponse)

Example 3 with GridDhtAssignmentFetchFuture

use of org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAssignmentFetchFuture in project ignite by apache.

the class CacheAffinitySharedManager method initAffinity.

/**
 * @param desc Cache group descriptor.
 * @param aff Affinity.
 * @param fut Exchange future.
 * @throws IgniteCheckedException If failed.
 */
private void initAffinity(CacheGroupDescriptor desc, GridAffinityAssignmentCache aff, GridDhtPartitionsExchangeFuture fut) throws IgniteCheckedException {
    assert desc != null : aff.cacheOrGroupName();
    ExchangeDiscoveryEvents evts = fut.context().events();
    if (canCalculateAffinity(desc, aff, fut))
        calculateAndInit(evts, aff, evts.topologyVersion());
    else {
        GridDhtAssignmentFetchFuture fetchFut = new GridDhtAssignmentFetchFuture(cctx, desc.groupId(), evts.topologyVersion(), evts.discoveryCache());
        fetchFut.init(false);
        fetchAffinity(evts.topologyVersion(), evts, evts.discoveryCache(), aff, fetchFut);
    }
}
Also used : GridDhtAssignmentFetchFuture(org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAssignmentFetchFuture)

Example 4 with GridDhtAssignmentFetchFuture

use of org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAssignmentFetchFuture in project ignite by apache.

the class CacheAffinitySharedManager method processClientCacheStartRequests.

/**
 * @param crd Coordinator flag.
 * @param msg Change request.
 * @param topVer Current topology version.
 * @param discoCache Discovery data cache.
 * @return Map of started caches (cache ID to near enabled flag).
 */
@Nullable
private Map<Integer, Boolean> processClientCacheStartRequests(boolean crd, ClientCacheChangeDummyDiscoveryMessage msg, AffinityTopologyVersion topVer, DiscoCache discoCache) {
    Map<String, DynamicCacheChangeRequest> startReqs = msg.startRequests();
    List<DynamicCacheDescriptor> startDescs = clientCachesToStart(msg.requestId(), startReqs);
    if (startDescs == null || startDescs.isEmpty()) {
        cctx.cache().completeClientCacheChangeFuture(msg.requestId(), null);
        return null;
    }
    Map<Integer, GridDhtAssignmentFetchFuture> fetchFuts = U.newHashMap(startDescs.size());
    Map<Integer, Boolean> startedInfos = U.newHashMap(startDescs.size());
    List<StartCacheInfo> startCacheInfos = startDescs.stream().map(desc -> {
        DynamicCacheChangeRequest changeReq = startReqs.get(desc.cacheName());
        startedInfos.put(desc.cacheId(), changeReq.nearCacheConfiguration() != null);
        return new StartCacheInfo(desc.cacheConfiguration(), desc, changeReq.nearCacheConfiguration(), topVer, changeReq.disabledAfterStart(), true);
    }).collect(Collectors.toList());
    Set<String> startedCaches = startCacheInfos.stream().map(info -> info.getCacheDescriptor().cacheName()).collect(Collectors.toSet());
    try {
        cctx.cache().prepareStartCaches(startCacheInfos);
    } catch (IgniteCheckedException e) {
        cctx.cache().closeCaches(startedCaches, false);
        cctx.cache().completeClientCacheChangeFuture(msg.requestId(), e);
        return null;
    }
    Set<CacheGroupDescriptor> groupDescs = startDescs.stream().map(DynamicCacheDescriptor::groupDescriptor).collect(Collectors.toSet());
    for (CacheGroupDescriptor grpDesc : groupDescs) {
        try {
            CacheGroupContext grp = cctx.cache().cacheGroup(grpDesc.groupId());
            assert grp != null : grpDesc.groupId();
            assert !grp.affinityNode() || grp.isLocal() : grp.cacheOrGroupName();
            // Skip for local caches.
            if (grp.isLocal())
                continue;
            CacheGroupHolder grpHolder = grpHolders.get(grp.groupId());
            assert !crd || (grpHolder != null && grpHolder.affinity().idealAssignmentRaw() != null);
            if (grpHolder == null)
                grpHolder = getOrCreateGroupHolder(topVer, grpDesc);
            // If current node is not client and current node have no aff holder.
            if (grpHolder.nonAffNode() && !cctx.localNode().isClient()) {
                GridDhtPartitionsExchangeFuture excFut = context().exchange().lastFinishedFuture();
                grp.topology().updateTopologyVersion(excFut, discoCache, -1, false);
                // Exchange free cache creation, just replacing client topology with dht.
                // Topology should be initialized before the use.
                grp.topology().beforeExchange(excFut, true, false);
                grpHolder = new CacheGroupAffNodeHolder(grp, grpHolder.affinity());
                grpHolders.put(grp.groupId(), grpHolder);
                GridClientPartitionTopology clientTop = cctx.exchange().clearClientTopology(grp.groupId());
                if (clientTop != null) {
                    grp.topology().update(grpHolder.affinity().lastVersion(), clientTop.partitionMap(true), clientTop.fullUpdateCounters(), Collections.<Integer>emptySet(), null, null, null, clientTop.lostPartitions());
                    excFut.validate(grp);
                }
                assert grpHolder.affinity().lastVersion().equals(grp.affinity().lastVersion());
            } else if (!crd && !fetchFuts.containsKey(grp.groupId())) {
                boolean topVerLessOrNotInitialized = !grp.topology().initialized() || grp.topology().readyTopologyVersion().compareTo(topVer) < 0;
                if (grp.affinity().lastVersion().compareTo(topVer) < 0 || topVerLessOrNotInitialized) {
                    GridDhtAssignmentFetchFuture fetchFut = new GridDhtAssignmentFetchFuture(cctx, grp.groupId(), topVer, discoCache);
                    fetchFut.init(true);
                    fetchFuts.put(grp.groupId(), fetchFut);
                }
            }
        } catch (IgniteCheckedException e) {
            cctx.cache().closeCaches(startedCaches, false);
            cctx.cache().completeClientCacheChangeFuture(msg.requestId(), e);
            return null;
        }
    }
    for (GridDhtAssignmentFetchFuture fetchFut : fetchFuts.values()) {
        try {
            CacheGroupContext grp = cctx.cache().cacheGroup(fetchFut.groupId());
            assert grp != null;
            GridDhtAffinityAssignmentResponse res = fetchAffinity(topVer, null, discoCache, grp.affinity(), fetchFut);
            GridDhtPartitionFullMap partMap;
            if (res != null) {
                partMap = res.partitionMap();
                assert partMap != null : res;
            } else
                partMap = new GridDhtPartitionFullMap(cctx.localNodeId(), cctx.localNode().order(), 1);
            GridDhtPartitionsExchangeFuture exchFut = context().exchange().lastFinishedFuture();
            grp.topology().updateTopologyVersion(exchFut, discoCache, -1, false);
            GridClientPartitionTopology clientTop = cctx.exchange().clearClientTopology(grp.groupId());
            Set<Integer> lostParts = clientTop == null ? null : clientTop.lostPartitions();
            grp.topology().update(topVer, partMap, null, Collections.emptySet(), null, null, null, lostParts);
            if (clientTop == null)
                grp.topology().detectLostPartitions(topVer, exchFut);
            exchFut.validate(grp);
        } catch (IgniteCheckedException e) {
            cctx.cache().closeCaches(startedCaches, false);
            cctx.cache().completeClientCacheChangeFuture(msg.requestId(), e);
            return null;
        }
    }
    for (DynamicCacheDescriptor desc : startDescs) {
        if (desc.cacheConfiguration().getCacheMode() != LOCAL) {
            CacheGroupContext grp = cctx.cache().cacheGroup(desc.groupId());
            assert grp != null;
            grp.topology().onExchangeDone(null, grp.affinity().cachedAffinity(topVer), true);
        }
    }
    cctx.cache().initCacheProxies(topVer, null);
    startReqs.keySet().forEach(req -> cctx.cache().completeProxyInitialize(req));
    cctx.cache().completeClientCacheChangeFuture(msg.requestId(), null);
    return startedInfos;
}
Also used : IgniteInternalFuture(org.apache.ignite.internal.IgniteInternalFuture) DiscoveryCustomEvent(org.apache.ignite.internal.events.DiscoveryCustomEvent) Arrays(java.util.Arrays) GridFutureAdapter(org.apache.ignite.internal.util.future.GridFutureAdapter) EVT_NODE_LEFT(org.apache.ignite.events.EventType.EVT_NODE_LEFT) GridFinishedFuture(org.apache.ignite.internal.util.future.GridFinishedFuture) GridPartitionStateMap(org.apache.ignite.internal.util.GridPartitionStateMap) IgniteSystemProperties(org.apache.ignite.IgniteSystemProperties) GridLongList(org.apache.ignite.internal.util.GridLongList) AFFINITY_CALCULATION(org.apache.ignite.internal.processors.tracing.SpanType.AFFINITY_CALCULATION) Map(java.util.Map) AffinityFunction(org.apache.ignite.cache.affinity.AffinityFunction) CacheGroupAffinityMessage(org.apache.ignite.internal.processors.cache.distributed.dht.preloader.CacheGroupAffinityMessage) GridDhtAssignmentFetchFuture(org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAssignmentFetchFuture) GridDhtPartitionState(org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState) IgniteFuture(org.apache.ignite.lang.IgniteFuture) IgniteInClosure(org.apache.ignite.lang.IgniteInClosure) LOCAL(org.apache.ignite.cache.CacheMode.LOCAL) Collection(java.util.Collection) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgniteException(org.apache.ignite.IgniteException) Event(org.apache.ignite.events.Event) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) IgniteInClosureX(org.apache.ignite.internal.util.lang.IgniteInClosureX) OWNING(org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState.OWNING) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) NONE(org.apache.ignite.cache.CacheRebalanceMode.NONE) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) EVT_NODE_FAILED(org.apache.ignite.events.EventType.EVT_NODE_FAILED) GridDhtPartitionTopology(org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionTopology) CU(org.apache.ignite.internal.util.typedef.internal.CU) Optional(java.util.Optional) DiscoveryEvent(org.apache.ignite.events.DiscoveryEvent) GridDhtAffinityAssignmentResponse(org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffinityAssignmentResponse) Span(org.apache.ignite.internal.processors.tracing.Span) GridCompoundFuture(org.apache.ignite.internal.util.future.GridCompoundFuture) U(org.apache.ignite.internal.util.typedef.internal.U) HashMap(java.util.HashMap) DiscoCache(org.apache.ignite.internal.managers.discovery.DiscoCache) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) ArrayList(java.util.ArrayList) ConcurrentMap(java.util.concurrent.ConcurrentMap) AffinityAssignment(org.apache.ignite.internal.processors.affinity.AffinityAssignment) HashSet(java.util.HashSet) LinkedHashMap(java.util.LinkedHashMap) GridClientPartitionTopology(org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridClientPartitionTopology) ClusterNode(org.apache.ignite.cluster.ClusterNode) DiscoveryCustomMessage(org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage) IgniteClosure(org.apache.ignite.lang.IgniteClosure) GridDhtPartitionsExchangeFuture(org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture) DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) GridDhtPartitionFullMap(org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap) CacheException(javax.cache.CacheException) F(org.apache.ignite.internal.util.typedef.F) EVT_NODE_JOINED(org.apache.ignite.events.EventType.EVT_NODE_JOINED) Iterator(java.util.Iterator) AffinityTopologyVersion(org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion) GridConcurrentHashSet(org.apache.ignite.internal.util.GridConcurrentHashSet) GridAffinityAssignmentCache(org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentCache) GridDhtPartitionMap(org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap) DiscoveryDataClusterState(org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) GridPlainRunnable(org.apache.ignite.internal.util.lang.GridPlainRunnable) Collections(java.util.Collections) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) GridLocalEventListener(org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener) IgniteUuid(org.apache.ignite.lang.IgniteUuid) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) GridDhtAssignmentFetchFuture(org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAssignmentFetchFuture) GridClientPartitionTopology(org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridClientPartitionTopology) GridDhtPartitionsExchangeFuture(org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture) GridDhtPartitionFullMap(org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap) GridDhtAffinityAssignmentResponse(org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffinityAssignmentResponse) Nullable(org.jetbrains.annotations.Nullable)

Example 5 with GridDhtAssignmentFetchFuture

use of org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAssignmentFetchFuture in project ignite by apache.

the class CacheAffinitySharedManager method fetchAffinityOnJoin.

/**
 * @param fut Exchange future.
 * @throws IgniteCheckedException If failed.
 */
private void fetchAffinityOnJoin(GridDhtPartitionsExchangeFuture fut) throws IgniteCheckedException {
    AffinityTopologyVersion topVer = fut.initialVersion();
    List<GridDhtAssignmentFetchFuture> fetchFuts = Collections.synchronizedList(new ArrayList<>());
    forAllRegisteredCacheGroups(new IgniteInClosureX<CacheGroupDescriptor>() {

        @Override
        public void applyx(CacheGroupDescriptor desc) throws IgniteCheckedException {
            CacheGroupHolder holder = getOrCreateGroupHolder(topVer, desc);
            if (fut.cacheGroupAddedOnExchange(desc.groupId(), desc.receivedFrom())) {
                // In case if merge is allowed do not calculate affinity since it can change on exchange end.
                if (!fut.context().mergeExchanges())
                    calculateAndInit(fut.events(), holder.affinity(), topVer);
            } else {
                if (fut.context().fetchAffinityOnJoin()) {
                    GridDhtAssignmentFetchFuture fetchFut = new GridDhtAssignmentFetchFuture(cctx, desc.groupId(), topVer, fut.events().discoveryCache());
                    fetchFut.init(false);
                    fetchFuts.add(fetchFut);
                } else {
                    if (!fut.events().discoveryCache().serverNodes().isEmpty())
                        fut.context().addGroupAffinityRequestOnJoin(desc.groupId());
                    else
                        calculateAndInit(fut.events(), holder.affinity(), topVer);
                }
            }
            cctx.exchange().exchangerUpdateHeartbeat();
        }
    });
    for (int i = 0; i < fetchFuts.size(); i++) {
        GridDhtAssignmentFetchFuture fetchFut = fetchFuts.get(i);
        int grpId = fetchFut.groupId();
        fetchAffinity(topVer, fut.events(), fut.events().discoveryCache(), groupAffinity(grpId), fetchFut);
        cctx.exchange().exchangerUpdateHeartbeat();
    }
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) AffinityTopologyVersion(org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion) GridDhtAssignmentFetchFuture(org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAssignmentFetchFuture)

Aggregations

GridDhtAssignmentFetchFuture (org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAssignmentFetchFuture)6 ArrayList (java.util.ArrayList)4 List (java.util.List)4 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)4 AffinityTopologyVersion (org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion)4 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)3 GridAffinityAssignmentCache (org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentCache)3 GridDhtAffinityAssignmentResponse (org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffinityAssignmentResponse)3 GridDhtPartitionsExchangeFuture (org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture)3 GridCompoundFuture (org.apache.ignite.internal.util.future.GridCompoundFuture)3 GridFutureAdapter (org.apache.ignite.internal.util.future.GridFutureAdapter)3 IgniteInClosureX (org.apache.ignite.internal.util.lang.IgniteInClosureX)3 UUID (java.util.UUID)2 GridLongList (org.apache.ignite.internal.util.GridLongList)2 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1