Search in sources :

Example 1 with CacheActionData

use of org.apache.ignite.internal.processors.cache.ExchangeActions.CacheActionData in project ignite by apache.

the class CacheBlockOnReadAbstractTest method createCachePredicate.

/**
 * Checks that given discovery event is from "Create cache" operation.
 *
 * @param discoEvt Discovery event.
 */
private static boolean createCachePredicate(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> startRequests = exchangeActions.cacheStartRequests();
            return !startRequests.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)

Example 2 with CacheActionData

use of org.apache.ignite.internal.processors.cache.ExchangeActions.CacheActionData 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)2 DiscoveryCustomMessage (org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage)2 DynamicCacheChangeBatch (org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch)2 ExchangeActions (org.apache.ignite.internal.processors.cache.ExchangeActions)2 CacheActionData (org.apache.ignite.internal.processors.cache.ExchangeActions.CacheActionData)2