Search in sources :

Example 1 with CacheServerNotFoundException

use of org.apache.ignite.cache.CacheServerNotFoundException in project ignite by apache.

the class DataStreamerImplSelfTest method testNoDataNodesOnFlush.

/**
     * Test logging on {@code DataStreamer.addData()} method when cache have no data nodes
     *
     * @throws Exception If fail.
     */
public void testNoDataNodesOnFlush() throws Exception {
    boolean failed = false;
    cnt = 0;
    noNodesFilter = true;
    try {
        Ignite ignite = startGrid(1);
        IgniteFuture fut = null;
        try (IgniteDataStreamer<Integer, String> streamer = ignite.dataStreamer(DEFAULT_CACHE_NAME)) {
            fut = streamer.addData(1, "1");
            streamer.flush();
        } catch (IllegalStateException ignored) {
            try {
                fut.get();
                fail("DataStreamer ignores failed streaming.");
            } catch (CacheServerNotFoundException ignored2) {
            // No-op.
            }
            failed = true;
        }
    } finally {
        noNodesFilter = false;
        assertTrue(failed);
    }
}
Also used : CacheServerNotFoundException(org.apache.ignite.cache.CacheServerNotFoundException) IgniteFuture(org.apache.ignite.lang.IgniteFuture) Ignite(org.apache.ignite.Ignite)

Example 2 with CacheServerNotFoundException

use of org.apache.ignite.cache.CacheServerNotFoundException in project ignite by apache.

the class GridCacheUtils method convertToCacheException.

/**
     * @param e Ignite checked exception.
     * @return CacheException runtime exception, never null.
     */
@NotNull
public static RuntimeException convertToCacheException(IgniteCheckedException e) {
    IgniteClientDisconnectedCheckedException disconnectedErr = e.getCause(IgniteClientDisconnectedCheckedException.class);
    if (disconnectedErr != null) {
        assert disconnectedErr.reconnectFuture() != null : disconnectedErr;
        e = disconnectedErr;
    }
    if (e.hasCause(CacheWriterException.class))
        return new CacheWriterException(U.convertExceptionNoWrap(e));
    if (e instanceof CachePartialUpdateCheckedException)
        return new CachePartialUpdateException((CachePartialUpdateCheckedException) e);
    else if (e instanceof CacheAtomicUpdateTimeoutCheckedException)
        return new CacheAtomicUpdateTimeoutException(e.getMessage(), e);
    else if (e instanceof ClusterTopologyServerNotFoundException)
        return new CacheServerNotFoundException(e.getMessage(), e);
    if (e.getCause() instanceof CacheException)
        return (CacheException) e.getCause();
    if (e.getCause() instanceof NullPointerException)
        return (NullPointerException) e.getCause();
    C1<IgniteCheckedException, IgniteException> converter = U.getExceptionConverter(e.getClass());
    return converter != null ? new CacheException(converter.apply(e)) : new CacheException(e);
}
Also used : CacheAtomicUpdateTimeoutException(org.apache.ignite.cache.CacheAtomicUpdateTimeoutException) CacheServerNotFoundException(org.apache.ignite.cache.CacheServerNotFoundException) CacheException(javax.cache.CacheException) CachePartialUpdateException(org.apache.ignite.cache.CachePartialUpdateException) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgniteException(org.apache.ignite.IgniteException) ClusterTopologyServerNotFoundException(org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException) IgniteClientDisconnectedCheckedException(org.apache.ignite.internal.IgniteClientDisconnectedCheckedException) CacheWriterException(javax.cache.integration.CacheWriterException) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

CacheServerNotFoundException (org.apache.ignite.cache.CacheServerNotFoundException)2 CacheException (javax.cache.CacheException)1 CacheWriterException (javax.cache.integration.CacheWriterException)1 Ignite (org.apache.ignite.Ignite)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IgniteException (org.apache.ignite.IgniteException)1 CacheAtomicUpdateTimeoutException (org.apache.ignite.cache.CacheAtomicUpdateTimeoutException)1 CachePartialUpdateException (org.apache.ignite.cache.CachePartialUpdateException)1 IgniteClientDisconnectedCheckedException (org.apache.ignite.internal.IgniteClientDisconnectedCheckedException)1 ClusterTopologyServerNotFoundException (org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException)1 IgniteFuture (org.apache.ignite.lang.IgniteFuture)1 NotNull (org.jetbrains.annotations.NotNull)1