Search in sources :

Example 1 with CachePartitionExchangeWorkerTask

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

the class PendingExchangeTest method waitForExchnagesBegin.

/**
 * Waiting for exchanges beginning.
 *
 * @param ignite Ignite.
 */
private void waitForExchnagesBegin(GridCachePartitionExchangeManager exchangeManager, int exchanges) {
    GridWorker exchWorker = U.field(exchangeManager, "exchWorker");
    Queue<CachePartitionExchangeWorkerTask> exchnageQueue = U.field(exchWorker, "futQ");
    try {
        assertTrue(GridTestUtils.waitForCondition(() -> {
            int exFuts = 0;
            for (CachePartitionExchangeWorkerTask task : exchnageQueue) {
                if (task instanceof GridDhtPartitionsExchangeFuture)
                    exFuts++;
            }
            return exFuts >= exchanges;
        }, 30_000));
    } catch (IgniteInterruptedCheckedException e) {
        fail("Can’t wait for the exchnages beginning.");
    }
}
Also used : IgniteInterruptedCheckedException(org.apache.ignite.internal.IgniteInterruptedCheckedException) GridDhtPartitionsExchangeFuture(org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture) CachePartitionExchangeWorkerTask(org.apache.ignite.internal.processors.cache.CachePartitionExchangeWorkerTask) GridWorker(org.apache.ignite.internal.util.worker.GridWorker)

Aggregations

IgniteInterruptedCheckedException (org.apache.ignite.internal.IgniteInterruptedCheckedException)1 CachePartitionExchangeWorkerTask (org.apache.ignite.internal.processors.cache.CachePartitionExchangeWorkerTask)1 GridDhtPartitionsExchangeFuture (org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture)1 GridWorker (org.apache.ignite.internal.util.worker.GridWorker)1