use of org.apache.ignite.spi.communication.CommunicationSpi in project ignite by apache.
the class GridDiscoveryManager method initCommunicationErrorResolveConfiguration.
/**
* @param cfg Configuration.
* @throws IgniteCheckedException If configuration is not valid.
*/
public static void initCommunicationErrorResolveConfiguration(IgniteConfiguration cfg) throws IgniteCheckedException {
CommunicationFailureResolver rslvr = cfg.getCommunicationFailureResolver();
CommunicationSpi commSpi = cfg.getCommunicationSpi();
DiscoverySpi discoverySpi = cfg.getDiscoverySpi();
if (rslvr != null) {
if (!supportsCommunicationErrorResolve(commSpi)) {
throw new IgniteCheckedException("CommunicationFailureResolver is configured, but CommunicationSpi does not support communication" + "problem resolve: " + commSpi.getClass().getName());
}
if (!supportsCommunicationErrorResolve(discoverySpi)) {
throw new IgniteCheckedException("CommunicationFailureResolver is configured, but DiscoverySpi does not support communication" + "problem resolve: " + discoverySpi.getClass().getName());
}
} else {
if (supportsCommunicationErrorResolve(commSpi) && supportsCommunicationErrorResolve(discoverySpi))
cfg.setCommunicationFailureResolver(new DefaultCommunicationFailureResolver());
}
}
use of org.apache.ignite.spi.communication.CommunicationSpi in project ignite by apache.
the class GridifySingleSplitLoadTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration() throws Exception {
IgniteConfiguration cfg = super.getConfiguration();
/* Uncomment following code if you start it manually. */
CommunicationSpi commSpi = new TcpCommunicationSpi();
cfg.setCommunicationSpi(commSpi);
DiscoverySpi discoSpi = new TcpDiscoverySpi();
cfg.setDiscoverySpi(discoSpi);
/*
*/
@SuppressWarnings("TypeMayBeWeakened") Log4JLogger log = (Log4JLogger) cfg.getGridLogger();
log.getLogger("org.apache.ignite").setLevel(Level.INFO);
return cfg;
}
use of org.apache.ignite.spi.communication.CommunicationSpi in project ignite by apache.
the class GridSingleSplitsRedeployLoadTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration() throws Exception {
IgniteConfiguration cfg = super.getConfiguration();
CommunicationSpi commSpi = new TcpCommunicationSpi();
cfg.setCommunicationSpi(commSpi);
DiscoverySpi discoSpi = new TcpDiscoverySpi();
cfg.setDiscoverySpi(discoSpi);
cfg.setDeploymentMode(DeploymentMode.CONTINUOUS);
return cfg;
}
use of org.apache.ignite.spi.communication.CommunicationSpi in project ignite by apache.
the class GridMultiSplitsLoadTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration() throws Exception {
IgniteConfiguration cfg = super.getConfiguration();
CommunicationSpi commSpi = new TcpCommunicationSpi();
cfg.setCommunicationSpi(commSpi);
DiscoverySpi discoSpi = new TcpDiscoverySpi();
cfg.setDiscoverySpi(discoSpi);
return cfg;
}
use of org.apache.ignite.spi.communication.CommunicationSpi in project ignite by apache.
the class TooManyOpenFilesTcpCommunicationSpiTest method testTooManyOpenFilesErr.
/**
* Test checks that node will fail in case of error "Too many open files" in {@link TcpCommunicationSpi}.
*
* @throws Exception If failed.
*/
@Test
public void testTooManyOpenFilesErr() throws Exception {
IgniteEx crd = startGrids(3);
crd.cluster().state(ClusterState.ACTIVE);
IgniteEx stopNode = grid(2);
CommunicationSpi stopNodeSpi = stopNode.context().config().getCommunicationSpi();
ConnectionClientPool connPool = U.field(stopNodeSpi, "clientPool");
GridNioServerWrapper nioSrvWrapper = U.field(stopNodeSpi, "nioSrvWrapper");
IgniteEx txNode = grid(1);
try (Transaction tx = txNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ, 60_000, 4)) {
IgniteCache<Object, Object> cache = txNode.cache(DEFAULT_CACHE_NAME);
cache.put(0, 1);
nioSrvWrapper.socketChannelFactory(() -> {
throw new SocketException("Too many open files");
});
connPool.forceCloseConnection(txNode.localNode().id());
cache.put(1, 2);
cache.put(2, 3);
cache.put(3, 4);
// hungs here.
tx.commit();
} catch (ClusterTopologyException e) {
log.error("Error wait commit", e);
}
assertTrue(waitForCondition(((IgniteKernal) stopNode)::isStopping, 60_000));
}
Aggregations