Search in sources :

Example 16 with DiscoveryCustomEvent

use of org.apache.ignite.internal.events.DiscoveryCustomEvent in project ignite by apache.

the class CacheBlockOnReadAbstractTest method destroyCachePredicate.

/**
 * Checks that given discovery event is from "Destroy cache" operation.
 *
 * @param discoEvt Discovery event.
 */
private static boolean destroyCachePredicate(DiscoveryEvent discoEvt) {
    if (discoEvt instanceof DiscoveryCustomEvent) {
        DiscoveryCustomEvent discoCustomEvt = (DiscoveryCustomEvent) discoEvt;
        DiscoveryCustomMessage customMsg = discoCustomEvt.customMessage();
        if (customMsg instanceof DynamicCacheChangeBatch) {
            DynamicCacheChangeBatch cacheChangeBatch = (DynamicCacheChangeBatch) customMsg;
            ExchangeActions exchangeActions = U.field(cacheChangeBatch, "exchangeActions");
            Collection<CacheActionData> stopRequests = exchangeActions.cacheStopRequests();
            return !stopRequests.isEmpty();
        }
    }
    return false;
}
Also used : CacheActionData(org.apache.ignite.internal.processors.cache.ExchangeActions.CacheActionData) ExchangeActions(org.apache.ignite.internal.processors.cache.ExchangeActions) DynamicCacheChangeBatch(org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch) DiscoveryCustomEvent(org.apache.ignite.internal.events.DiscoveryCustomEvent) DiscoveryCustomMessage(org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage)

Aggregations

DiscoveryCustomEvent (org.apache.ignite.internal.events.DiscoveryCustomEvent)16 DiscoveryCustomMessage (org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage)10 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)7 DynamicCacheChangeBatch (org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch)7 ClusterNode (org.apache.ignite.cluster.ClusterNode)6 AffinityTopologyVersion (org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion)5 IgniteInterruptedCheckedException (org.apache.ignite.internal.IgniteInterruptedCheckedException)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 List (java.util.List)3 UUID (java.util.UUID)3 DiscoveryEvent (org.apache.ignite.events.DiscoveryEvent)3 IgniteNeedReconnectException (org.apache.ignite.internal.IgniteNeedReconnectException)3 CacheGroupContext (org.apache.ignite.internal.processors.cache.CacheGroupContext)3 SnapshotDiscoveryMessage (org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotDiscoveryMessage)3 Test (org.junit.Test)3 Map (java.util.Map)2 Set (java.util.Set)2 ConcurrentMap (java.util.concurrent.ConcurrentMap)2