Java Code Examples for org.apache.ignite.Ignite#close()

The following examples show how to use org.apache.ignite.Ignite#close() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocalIgniteCluster.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * Remove one random node.
 */
public synchronized void failNode() {
    if (srvs.isEmpty())
        throw new IllegalStateException("Cannot remove node from empty cluster");

    Ignite srv = srvs.get(rnd.nextInt(srvs.size()));

    IgniteConfiguration cfg = srv.configuration();

    NodeConfiguration nodeCfg = new NodeConfiguration(
        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).getIpFinder().getRegisteredAddresses().iterator().next().getPort(),
        Objects.requireNonNull(cfg.getClientConnectorConfiguration()).getPort()
    );

    srv.close();

    srvs.remove(srv);

    failedCfgs.add(nodeCfg);
}
 
Example 2
Source File: IgniteLaunchInModularEnvTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
@Test
public void testPdsEnabledSimpleLaunch() {
    IgniteConfiguration cfg = igniteConfiguration();

    DataRegionConfiguration regCfg = new DataRegionConfiguration()
        .setMaxSize(256L * 1024 * 1024)
        .setPersistenceEnabled(true);

    cfg.setDataStorageConfiguration(
        new DataStorageConfiguration()
            .setDefaultDataRegionConfiguration(regCfg));

    Ignite ignite = Ignition.start(cfg);

    ignite.cluster().active(true);

    String cacheName = "CACHE";
    ignite.getOrCreateCache(cacheName).put("key", "value");
    ignite.close();
}
 
Example 3
Source File: IgniteTestHelper.java    From hibernate-ogm-ignite with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void dropSchemaAndDatabase(SessionFactory sessionFactory) {
	if ( Ignition.allGrids().size() > 1 ) { // some tests doesn't stop DatastareProvider
		String currentGridName = getProvider( sessionFactory ).getGridName();
		for ( Ignite grid : Ignition.allGrids() ) {
			if ( !Objects.equals( currentGridName, grid.name() ) ) {
				grid.close();
			}
		}
	}
}
 
Example 4
Source File: HelloIgnite.java    From ignite-book-code-samples with GNU General Public License v3.0 5 votes vote down vote up
public static void main(String[] args) {
    System.out.println("Hello Ignite");
    // create a new instance of TCP Discovery SPI
    TcpDiscoverySpi spi = new TcpDiscoverySpi();
    // create a new instance of tcp discovery multicast ip finder
    TcpDiscoveryMulticastIpFinder tcMp = new TcpDiscoveryMulticastIpFinder();
    tcMp.setAddresses(Arrays.asList("localhost")); // change your IP address here
    // set the multi cast ip finder for spi
    spi.setIpFinder(tcMp);
    // create new ignite configuration
    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setClientMode(false);
    // set the discovery spi to ignite configuration
    cfg.setDiscoverySpi(spi);
    // Start ignite
    Ignite ignite = Ignition.start(cfg);
    // get or create cache
    IgniteCache<Integer, String> cache = ignite.getOrCreateCache("testCache");
    // put some cache elements
    for(int i = 1; i <= 100; i++){
        cache.put(i, Integer.toString(i));
    }
    // get them from the cache and write to the console
    for(int i =1; i<= 100; i++){
        System.out.println("Cache get:"+ cache.get(i));
    }
    ignite.close();

}
 
Example 5
Source File: IgniteWalRecoveryTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @throws Exception If fail.
 */
@Test
public void testEvictPartition() throws Exception {
    Ignite ignite1 = startGrid("node1");

    ignite1.cluster().active(true);

    IgniteCache<Object, Object> cache1 = ignite1.cache(CACHE_NAME);

    for (int i = 0; i < 100; i++)
        cache1.put(i, new IndexedObject(i));

    Ignite ignite2 = startGrid("node2");

    IgniteCache<Object, Object> cache2 = ignite2.cache(CACHE_NAME);

    for (int i = 0; i < 100; i++) {
        assertEquals(new IndexedObject(i), cache1.get(i));
        assertEquals(new IndexedObject(i), cache2.get(i));
    }

    ignite1.close();
    ignite2.close();

    ignite1 = startGrid("node1");
    ignite2 = startGrid("node2");

    ignite1.cluster().active(true);

    cache1 = ignite1.cache(CACHE_NAME);
    cache2 = ignite2.cache(CACHE_NAME);

    for (int i = 0; i < 100; i++) {
        assertEquals(new IndexedObject(i), cache1.get(i));
        assertEquals(new IndexedObject(i), cache2.get(i));
    }
}
 
Example 6
Source File: IgniteLaunchInModularEnvTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Tests ignite startup without any features used.
 */
@Test
public void testSimpleLaunch() {
    IgniteConfiguration cfg = igniteConfiguration();

    Ignite ignite = Ignition.start(cfg);

    ignite.close();
}
 
Example 7
Source File: ContinuousQueryReassignmentTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testContinuousQueryWithRemoteFilterNotCalledOnReassignment() throws Exception {
    Ignite lsnrNode = startGrid(1);
    Ignite victim = startGrid(2);

    awaitPartitionMapExchange();

    CacheConfiguration<Integer, String> cacheCfg = new CacheConfiguration<>("cache");
    cacheCfg.setBackups(1);
    IgniteCache<Integer, String> cache = lsnrNode.getOrCreateCache(cacheCfg);

    AtomicInteger updCntr = new AtomicInteger();

    CacheEntryEventSerializableFilter<Integer, String> filter = (e) -> e.getKey() % 2 == 0;

    listenToUpdates(cache, false, updCntr, filter);

    int updates = 1000;

    for (int i = 0; i < updates; i++)
        cache.put(i, Integer.toString(i));

    assertTrue(
        "Failed to wait for continuous query updates. Exp: " + updates + "; actual: " + updCntr.get(),
        waitForCondition(() -> updCntr.get() == updates / 2, 10000));

    victim.close();

    assertFalse("Continuous query is called on reassignment.",
        waitForCondition(() -> updCntr.get() > updates / 2, 2000));
}
 
Example 8
Source File: TcpClientDiscoverySpiCoordinatorChangeTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Checks that a client node doesn't fail because of coordinator change.
 *
 * @throws Exception If test fails.
 */
@Test
public void testClientNotFailed() throws Exception {
    TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);

    // Start server A.
    Ignite srvA = startNode("server-a", ipFinder, false);

    // Start the client.
    Ignite client = startNode("client", ipFinder, true);

    AtomicBoolean clientReconnectState = getClientReconnectState(client);

    // Start server B.
    Ignite srvB = startNode("server-b", ipFinder, false);

    // Stop server A.
    srvA.close();

    // Will throw an exception if the client is disconnected.
    client.getOrCreateCache("CACHE-NAME");

    // Check that the client didn't disconnect/reconnect quickly.
    assertFalse("Client node was failed and reconnected to the cluster.", clientReconnectState.get());

    // Stop the client.
    client.close();

    // Stop server B.
    srvB.close();
}
 
Example 9
Source File: WalRebalanceRestartTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * Stop first found supplier for current rebalance on specific node.
 *
 * @param ignite Ignite.
 */
private void stopFirstFoundSupplier(IgniteEx ignite) {
    IgniteInternalFuture rebFut = ignite.cachex(DEFAULT_CACHE_NAME).context().preloader().rebalanceFuture();

    assertFalse(rebFut.isDone());

    Map<UUID, IgniteDhtDemandedPartitionsMap> remainding = U.field(rebFut, "remaining");

    assertFalse(remainding.isEmpty());

    UUID supplierId = remainding.keySet().iterator().next();

    info("First dupplier: " + supplierId);

    for (Ignite ign : G.allGrids()) {
        if (ign.cluster().localNode().id().equals(supplierId))
            ign.close();
    }
}
 
Example 10
Source File: IgniteCacheClientNodePartitionsExchangeTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testServerNodeLeave() throws Exception {
    Ignite ignite0 = startGrid(0);

    final Ignite ignite1 = startClientGrid(1);

    waitForTopologyUpdate(2, 2);

    final Ignite ignite2 = startClientGrid(2);

    waitForTopologyUpdate(3, 3);

    ignite0.close();

    waitForTopologyUpdate(2, 4);

    GridTestUtils.assertThrows(log, new Callable<Void>() {
        @Override public Void call() throws Exception {
            ignite1.cache(DEFAULT_CACHE_NAME).get(1);

            return null;
        }
    }, CacheServerNotFoundException.class, null);

    GridTestUtils.assertThrows(log, new Callable<Void>() {
        @Override public Void call() throws Exception {
            ignite2.cache(DEFAULT_CACHE_NAME).get(1);

            return null;
        }
    }, CacheServerNotFoundException.class, null);

    ignite1.close();

    waitForTopologyUpdate(1, 5);

    GridTestUtils.assertThrows(log, new Callable<Void>() {
        @Override public Void call() throws Exception {
            ignite2.cache(DEFAULT_CACHE_NAME).get(1);

            return null;
        }
    }, CacheServerNotFoundException.class, null);
}
 
Example 11
Source File: GridP2PCountTiesLoadClassDirectlyFromClassLoaderTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @throws Exception if error occurs.
 */
public void executeP2PTaskWithRestartMaster(DeploymentMode depMode) throws Exception {
    try {
        CountTriesClassLoader testCntLdr = new CountTriesClassLoader(Thread.currentThread()
            .getContextClassLoader());

        this.depMode = depMode;

        Thread.currentThread().setContextClassLoader(testCntLdr);

        String path = GridTestProperties.getProperty(CLS_PATH_PROPERTY);

        ClassLoader urlClsLdr = new URLClassLoader(new URL[] {new URL(path)}, testCntLdr);

        Ignite ignite = startGrids(2);

        Map<UUID, Integer> res = (Map<UUID, Integer>)ignite.compute(ignite.cluster().forRemotes()).execute(
            (ComputeTask<Integer, Object>)urlClsLdr.loadClass(COMPUTE_STEALING_TASK_NAME).newInstance(), 1);

        info("Result: " + res);

        int cnt = testCntLdr.count;

        ignite.compute(ignite.cluster().forRemotes()).execute(COMPUTE_STEALING_TASK_NAME, 2);
        ignite.compute(ignite.cluster().forRemotes()).execute(COMPUTE_STEALING_TASK_NAME, 3);
        ignite.compute(ignite.cluster().forRemotes()).execute(COMPUTE_STEALING_TASK_NAME, 4);

        assertEquals(cnt, testCntLdr.count);

        ignite.close();

        ignite = startGrid(0);

        try {
            ignite.compute().execute(COMPUTE_STEALING_TASK_NAME, 5);

            if (depMode != DeploymentMode.CONTINUOUS)
                fail("Task should be undeployed.");
        }
        catch (IgniteDeploymentException e) {
            if (depMode != DeploymentMode.CONTINUOUS)
                assertTrue(e.getMessage(), e.getMessage().contains("Unknown task name or failed to auto-deploy task"));
            else
                fail(e.getMessage());
        }
    }
    finally {
        stopAllGrids();
    }
}
 
Example 12
Source File: TcpDiscoveryPendingMessageDeliveryTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testCustomMessageInSingletonCluster() throws Exception {
    Ignite coord = startGrid("coordinator");
    TcpDiscoverySpi coordDisco = (TcpDiscoverySpi)coord.configuration().getDiscoverySpi();

    Set<TcpDiscoveryAbstractMessage> sentEnsuredMsgs = new GridConcurrentHashSet<>();
    coordDisco.addSendMessageListener(msg -> {
        if (coordDisco.ensured(msg))
            sentEnsuredMsgs.add(msg);
    });

    // Custom message on a singleton cluster shouldn't break consistency of PendingMessages.
    sendDummyCustomMessage(coordDisco, IgniteUuid.randomUuid());

    // Victim doesn't send acknowledges, so we need an intermediate node to accept messages,
    // so the coordinator could mark them as pending.
    Ignite mediator = startGrid("mediator");

    Ignite victim = startGrid("victim");

    startGrid("listener");

    sentEnsuredMsgs.clear();
    receivedEnsuredMsgs.clear();

    blockMsgs = true;

    log.info("Sending dummy custom messages");

    // Non-discarded messages shouldn't be dropped from the queue.
    int msgsNum = 100;

    for (int i = 0; i < msgsNum; i++)
        sendDummyCustomMessage(coordDisco, IgniteUuid.randomUuid());

    mediator.close();
    victim.close();

    assertTrue("Sent: " + sentEnsuredMsgs + "; received: " + receivedEnsuredMsgs,
        GridTestUtils.waitForCondition(() -> {
            log.info("Waiting for messages delivery");

            return receivedEnsuredMsgs.equals(sentEnsuredMsgs);
        }, 10000));
}
 
Example 13
Source File: TcpDiscoveryPendingMessageDeliveryTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testPendingMessagesOverflow() throws Exception {
    Ignite coord = startGrid("coordinator");
    TcpDiscoverySpi coordDisco = (TcpDiscoverySpi)coord.configuration().getDiscoverySpi();

    Set<TcpDiscoveryAbstractMessage> sentEnsuredMsgs = new GridConcurrentHashSet<>();
    coordDisco.addSendMessageListener(msg -> {
        if (coordDisco.ensured(msg))
            sentEnsuredMsgs.add(msg);
    });

    // Victim doesn't send acknowledges, so we need an intermediate node to accept messages,
    // so the coordinator could mark them as pending.
    Ignite mediator = startGrid("mediator");

    Ignite victim = startGrid("victim");

    startGrid("listener");

    sentEnsuredMsgs.clear();
    receivedEnsuredMsgs.clear();

    // Initial custom message will travel across the ring and will be discarded.
    sendDummyCustomMessage(coordDisco, IgniteUuid.randomUuid());

    assertTrue("Sent: " + sentEnsuredMsgs + "; received: " + receivedEnsuredMsgs,
        GridTestUtils.waitForCondition(() -> {
            log.info("Waiting for messages delivery");

            return receivedEnsuredMsgs.equals(sentEnsuredMsgs);
        }, 10000));

    blockMsgs = true;

    log.info("Sending dummy custom messages");

    // Non-discarded messages shouldn't be dropped from the queue.
    int msgsNum = 2000;

    for (int i = 0; i < msgsNum; i++)
        sendDummyCustomMessage(coordDisco, IgniteUuid.randomUuid());

    mediator.close();
    victim.close();

    assertTrue("Sent: " + sentEnsuredMsgs + "; received: " + receivedEnsuredMsgs,
        GridTestUtils.waitForCondition(() -> {
            log.info("Waiting for messages delivery [sentSize=" + sentEnsuredMsgs.size() + ", rcvdSize=" + receivedEnsuredMsgs.size() + ']');

            return receivedEnsuredMsgs.equals(sentEnsuredMsgs);
        }, 10000));
}
 
Example 14
Source File: WalRecoveryTxLogicalRecordsTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testFreeListRecovery() throws Exception {
    try {
        pageSize = 1024;
        extraCcfg = new CacheConfiguration(CACHE2_NAME);

        Ignite ignite = startGrid(0);

        ignite.cluster().active(true);

        IgniteCache<Integer, IndexedValue> cache1 = ignite.cache(CACHE_NAME);
        IgniteCache<Object, Object> cache2 = ignite.cache(CACHE2_NAME);

        final int KEYS1 = 2048;

        for (int i = 0; i < KEYS1; i++)
            cache1.put(i, new IndexedValue(i));

        for (int i = 0; i < KEYS1; i++) {
            if (i % 2 == 0)
                cache1.remove(i);
        }

        ThreadLocalRandom rnd = ThreadLocalRandom.current();

        for (int i = 0; i < KEYS1; i++) {
            cache2.put(i, new byte[rnd.nextInt(512)]);

            if (rnd.nextBoolean())
                cache2.put(i, new byte[rnd.nextInt(512)]);

            if (rnd.nextBoolean())
                cache2.remove(i);
        }

        Map<Integer, T2<Map<Integer, long[]>, int[]>> cache1_1 = getFreeListData(ignite, CACHE_NAME);
        Map<Integer, T2<Map<Integer, long[]>, int[]>> cache2_1 = getFreeListData(ignite, CACHE2_NAME);
        T2<long[], Integer> rl1_1 = getReuseListData(ignite, CACHE_NAME);
        T2<long[], Integer> rl2_1 = getReuseListData(ignite, CACHE2_NAME);

        ignite.close();

        ignite = startGrid(0);

        ignite.cluster().active(true);

        cache1 = ignite.cache(CACHE_NAME);
        cache2 = ignite.cache(CACHE2_NAME);

        for (int i = 0; i < KEYS1; i++) {
            cache1.get(i);
            cache2.get(i);
        }

        Map<Integer, T2<Map<Integer, long[]>, int[]>> cache1_2 = getFreeListData(ignite, CACHE_NAME);
        Map<Integer, T2<Map<Integer, long[]>, int[]>> cache2_2 = getFreeListData(ignite, CACHE2_NAME);
        T2<long[], Integer> rl1_2 = getReuseListData(ignite, CACHE_NAME);
        T2<long[], Integer> rl2_2 = getReuseListData(ignite, CACHE2_NAME);

        checkEquals(cache1_1, cache1_2);
        checkEquals(cache2_1, cache2_2);
        checkEquals(rl1_1, rl1_2);
        checkEquals(rl2_1, rl2_2);
    }
    finally {
        stopAllGrids();
    }
}
 
Example 15
Source File: P2PScanQueryUndeployTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @param client ignite instance.
 * @param predCls loaded predicate class.
 * @throws Exception if failed.
 */
private void invokeScanQueryAndStopClient(Ignite client, Class predCls) throws Exception {
    IgniteCache<Integer, String> cache = client.getOrCreateCache(CACHE_NAME);

    assertEquals("Invalid number of sent grid deployment requests", 0, MessageCountingCommunicationSpi.deploymentRequestCount());

    assertFalse(PREDICATE_CLASSNAME + " mustn't be cached! ", igniteUtilsCachedClasses().contains(PREDICATE_CLASSNAME));

    cache.query(new ScanQuery<>((IgniteBiPredicate<Integer, String>)predCls.newInstance())).getAll();

    // first request is GridDeployment.java 716 and second is GridDeployment.java 501
    assertEquals("Invalid number of sent grid deployment requests", 2, MessageCountingCommunicationSpi.deploymentRequestCount());

    assertTrue(PREDICATE_CLASSNAME + " must be cached! ", igniteUtilsCachedClasses().contains(PREDICATE_CLASSNAME));

    client.close();

    assertFalse(PREDICATE_CLASSNAME + " mustn't be cached! ", igniteUtilsCachedClasses().contains(PREDICATE_CLASSNAME));
}
 
Example 16
Source File: ComputeJobCancelWithServiceSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testJobCancel() throws Exception {
    Ignite server = startGrid("server");

    server.services().deployNodeSingleton("my-service", new MyService());

    Ignite client = startClientGrid("client");

    ComputeTaskFuture<Integer> fut = client.compute().executeAsync(new MyTask(), null);

    Thread.sleep(3000);

    server.close();

    assertEquals(42, fut.get().intValue());
}
 
Example 17
Source File: WalRecoveryTxLogicalRecordsTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testRecoveryRandomPutRemove() throws Exception {
    try {
        pageSize = 1024;

        extraCcfg = new CacheConfiguration(CACHE2_NAME);
        extraCcfg.setAffinity(new RendezvousAffinityFunction(false, PARTS));

        Ignite ignite = startGrid(0);

        ignite.cluster().active(true);

        GridCacheDatabaseSharedManager dbMgr = (GridCacheDatabaseSharedManager)((IgniteEx)ignite).context()
            .cache().context().database();

        dbMgr.enableCheckpoints(false).get();

        IgniteCache<Integer, IndexedValue> cache1 = ignite.cache(CACHE_NAME);
        IgniteCache<Object, Object> cache2 = ignite.cache(CACHE2_NAME);

        final int KEYS1 = 100;

        for (int i = 0; i < KEYS1; i++)
            cache1.put(i, new IndexedValue(i));

        for (int i = 0; i < KEYS1; i++) {
            if (i % 2 == 0)
                cache1.remove(i);
        }

        ThreadLocalRandom rnd = ThreadLocalRandom.current();

        for (int i = 0; i < KEYS1; i++) {
            cache2.put(i, new byte[rnd.nextInt(512)]);

            if (rnd.nextBoolean())
                cache2.put(i, new byte[rnd.nextInt(512)]);

            if (rnd.nextBoolean())
                cache2.remove(i);
        }

        ignite.close();

        ignite = startGrid(0);

        ignite.cluster().active(true);

        ignite.cache(CACHE_NAME).put(1, new IndexedValue(0));
    }
    finally {
        stopAllGrids();
    }
}
 
Example 18
Source File: MetaStorageCompatibilityTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override public void apply(Ignite ignite) {
    ignite.active(true);

    ignite.close();
}
 
Example 19
Source File: IgniteCacheManyClientsTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/**
 * @throws Exception If failed.
 */
private void manyClientsSequentially() throws Exception {
    List<Ignite> clients = new ArrayList<>();

    final int CLIENTS = 50;

    int idx = SRVS;

    ThreadLocalRandom rnd = ThreadLocalRandom.current();

    for (int i = 0; i < CLIENTS; i++) {
        Ignite ignite = startClientGrid(idx++);

        log.info("Started node: " + ignite.name());

        assertTrue(ignite.configuration().isClientMode());

        clients.add(ignite);

        IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME);

        Integer key = rnd.nextInt(0, 1000);

        cache.put(key, i);

        assertNotNull(cache.get(key));
    }

    log.info("All clients started.");

    try {
        checkNodes0(SRVS + CLIENTS);
    }
    finally {
        for (Ignite client : clients)
            client.close();
    }
}
 
Example 20
Source File: IgniteTxCachePrimarySyncTest.java    From ignite with Apache License 2.0 2 votes vote down vote up
/**
 * @param client Node executing cache operation.
 * @param ccfg Cache configuration.
 * @param c Cache update closure.
 * @throws Exception If failed.
 */
private void singleKeyPrimaryNodeLeft(
    Ignite client,
    final CacheConfiguration<Object, Object> ccfg,
    final IgniteBiInClosure<Integer, IgniteCache<Object, Object>> c) throws Exception {
    Ignite ignite = startGrid(NODES);

    awaitPartitionMapExchange();

    final TestRecordingCommunicationSpi commSpiClient =
        (TestRecordingCommunicationSpi)client.configuration().getCommunicationSpi();

    IgniteCache<Object, Object> cache = ignite.cache(ccfg.getName());

    final Integer key = primaryKey(cache);

    cache.remove(key);

    waitKeyRemoved(ccfg.getName(), key);

    commSpiClient.blockMessages(GridNearTxFinishRequest.class, ignite.name());

    final IgniteCache<Object, Object> clientCache = client.cache(ccfg.getName());

    IgniteInternalFuture<?> fut = GridTestUtils.runAsync(new Callable<Void>() {
        @Override public Void call() throws Exception {
            c.apply(key, clientCache);

            return null;
        }
    });

    boolean waitMsgSnd = GridTestUtils.waitForCondition(new GridAbsPredicate() {
        @Override public boolean apply() {
            return commSpiClient.hasBlockedMessages();
        }
    }, 5000);

    assertTrue(waitMsgSnd);

    ignite.close();

    commSpiClient.stopBlock(false);

    fut.get();

    awaitPartitionMapExchange();

    waitKeyUpdated(client, ccfg.getBackups() + 1, ccfg.getName(), key);

    clientCache.remove(key);

    waitKeyRemoved(ccfg.getName(), key);

    c.apply(key, clientCache);

    waitKeyUpdated(client, ccfg.getBackups() + 1, ccfg.getName(), key);
}