Search in sources :

Example 6 with IgniteDataStreamerTimeoutException

use of org.apache.ignite.IgniteDataStreamerTimeoutException in project ignite by apache.

the class DataStreamerTimeoutTest method testTimeoutOnCloseMethod.

/**
 * Test timeout on {@code DataStreamer.addData()} method
 * @throws Exception If fail.
 */
@Test
public void testTimeoutOnCloseMethod() throws Exception {
    failOn = 1;
    Ignite ignite = startGrid(1);
    boolean thrown = false;
    try (IgniteDataStreamer ldr = ignite.dataStreamer(CACHE_NAME)) {
        ldr.timeout(TIMEOUT);
        ldr.receiver(new TestDataReceiver());
        ldr.perNodeBufferSize(ENTRY_AMOUNT);
        for (int i = 0; i < ENTRY_AMOUNT; i++) ldr.addData(i, i);
    } catch (CacheException | IgniteDataStreamerTimeoutException ignored) {
        thrown = true;
    } finally {
        stopAllGrids();
    }
    assertTrue(thrown);
}
Also used : IgniteDataStreamer(org.apache.ignite.IgniteDataStreamer) IgniteDataStreamerTimeoutException(org.apache.ignite.IgniteDataStreamerTimeoutException) CacheException(javax.cache.CacheException) Ignite(org.apache.ignite.Ignite) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Aggregations

IgniteDataStreamerTimeoutException (org.apache.ignite.IgniteDataStreamerTimeoutException)6 ArrayList (java.util.ArrayList)2 CacheException (javax.cache.CacheException)2 Ignite (org.apache.ignite.Ignite)2 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)2 IgniteDataStreamer (org.apache.ignite.IgniteDataStreamer)2 GridFutureAdapter (org.apache.ignite.internal.util.future.GridFutureAdapter)2 ArrayDeque (java.util.ArrayDeque)1 Collection (java.util.Collection)1 IgniteInterruptedException (org.apache.ignite.IgniteInterruptedException)1 IgniteClientDisconnectedCheckedException (org.apache.ignite.internal.IgniteClientDisconnectedCheckedException)1 IgniteFutureTimeoutCheckedException (org.apache.ignite.internal.IgniteFutureTimeoutCheckedException)1 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)1 IgniteInterruptedCheckedException (org.apache.ignite.internal.IgniteInterruptedCheckedException)1 IgniteCacheFutureImpl (org.apache.ignite.internal.processors.cache.IgniteCacheFutureImpl)1 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)1 Test (org.junit.Test)1