Search in sources :

Example 6 with CacheRebalancingEvent

use of org.apache.ignite.events.CacheRebalancingEvent in project ignite by apache.

the class GridCachePartitionedUnloadEventsSelfTest method checkPartitionUnloadEvents.

/**
     * @param evts Events.
     * @param g Grid.
     * @param parts Parts.
     */
private void checkPartitionUnloadEvents(Collection<Event> evts, Ignite g, Collection<GridDhtLocalPartition> parts) {
    assertEquals(parts.size(), evts.size());
    for (Event evt : evts) {
        CacheRebalancingEvent unloadEvt = (CacheRebalancingEvent) evt;
        final int part = unloadEvt.partition();
        assertNotNull("Unexpected partition: " + part, F.find(parts, null, new IgnitePredicate<GridDhtLocalPartition>() {

            @Override
            public boolean apply(GridDhtLocalPartition e) {
                return e.id() == part;
            }
        }));
        assertEquals(g.cache(DEFAULT_CACHE_NAME).getName(), unloadEvt.cacheName());
        assertEquals(g.cluster().localNode().id(), unloadEvt.node().id());
    }
}
Also used : IgnitePredicate(org.apache.ignite.lang.IgnitePredicate) CacheEvent(org.apache.ignite.events.CacheEvent) Event(org.apache.ignite.events.Event) CacheRebalancingEvent(org.apache.ignite.events.CacheRebalancingEvent) CacheRebalancingEvent(org.apache.ignite.events.CacheRebalancingEvent)

Aggregations

CacheRebalancingEvent (org.apache.ignite.events.CacheRebalancingEvent)6 Event (org.apache.ignite.events.Event)5 ClusterNode (org.apache.ignite.cluster.ClusterNode)3 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 UUID (java.util.UUID)2 Ignite (org.apache.ignite.Ignite)2 CacheEvent (org.apache.ignite.events.CacheEvent)2 IgniteFuture (org.apache.ignite.lang.IgniteFuture)2 IgnitePredicate (org.apache.ignite.lang.IgnitePredicate)2 HashMap (java.util.HashMap)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 IgniteException (org.apache.ignite.IgniteException)1 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)1 CacheQueryExecutedEvent (org.apache.ignite.events.CacheQueryExecutedEvent)1 CacheQueryReadEvent (org.apache.ignite.events.CacheQueryReadEvent)1 CheckpointEvent (org.apache.ignite.events.CheckpointEvent)1 DiscoveryEvent (org.apache.ignite.events.DiscoveryEvent)1 EventAdapter (org.apache.ignite.events.EventAdapter)1 JobEvent (org.apache.ignite.events.JobEvent)1