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);
}
}
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);
}
Aggregations