use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class GridSessionCancelSiblingsFromFutureSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
c.setDiscoverySpi(discoSpi);
c.setPublicThreadPoolSize(SPLIT_COUNT * EXEC_COUNT);
return c;
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class GridSessionCancelSiblingsFromJobSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
c.setDiscoverySpi(discoSpi);
c.setPublicThreadPoolSize(SPLIT_COUNT * EXEC_COUNT);
return c;
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class Log4j2LoggerVerboseModeSelfTest method getConfiguration.
/**
* Creates grid configuration.
*
* @param igniteInstanceName Ignite instance name.
* @param logPath Logger configuration path.
* @return Grid configuration.
* @throws Exception If error occurred.
*/
private static IgniteConfiguration getConfiguration(String igniteInstanceName, String logPath) throws Exception {
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(new TcpDiscoveryVmIpFinder(false) {
{
setAddresses(Collections.singleton("127.0.0.1:47500..47509"));
}
});
File xml = GridTestUtils.resolveIgnitePath(LOG_PATH_VERBOSE_TEST);
Log4J2Logger logger = new Log4J2Logger(xml);
return new IgniteConfiguration().setIgniteInstanceName(igniteInstanceName).setGridLogger(logger).setConnectorConfiguration(null).setDiscoverySpi(disco);
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class TcpClientDiscoverySpiFailureTimeoutSelfTest method clientReconnectOnCoordinatorRouterFail.
/**
* Test tries to provoke scenario when client sends reconnect message before router failure detected.
*
* @param srvNodes Number of additional server nodes.
* @throws Exception If failed.
*/
public void clientReconnectOnCoordinatorRouterFail(int srvNodes) throws Exception {
startServerNodes(1);
Ignite srv = G.ignite("server-0");
final TcpDiscoveryNode srvNode = (TcpDiscoveryNode) srv.cluster().localNode();
final UUID srvNodeId = srvNode.id();
clientIpFinder = new TcpDiscoveryVmIpFinder();
clientIpFinder.setAddresses(Collections.singleton("localhost:" + srvNode.discoveryPort() + ".." + (srvNode.discoveryPort() + 1)));
failureThreshold = 1000L;
netTimeout = 1000L;
// Client should connect to coordinator.
startClientNodes(1);
failureThreshold = 10_000L;
netTimeout = 5000L;
List<String> nodes = new ArrayList<>();
for (int i = 0; i < srvNodes; i++) {
Ignite g = startGrid("server-" + srvIdx.getAndIncrement());
nodes.add(g.name());
srvNodeIds.add(g.cluster().localNode().id());
}
checkNodes(1 + srvNodes, 1);
nodes.add("client-0");
final CountDownLatch latch = new CountDownLatch(nodes.size());
final AtomicBoolean err = new AtomicBoolean();
for (String node : nodes) {
G.ignite(node).events().localListen(new IgnitePredicate<Event>() {
@Override
public boolean apply(Event evt) {
DiscoveryEvent disoEvt = (DiscoveryEvent) evt;
if (disoEvt.eventNode().id().equals(srvNodeId)) {
info("Expected node failed event: " + ((DiscoveryEvent) evt).eventNode());
latch.countDown();
} else {
log.info("Unexpected node failed event: " + evt);
err.set(true);
}
return true;
}
}, EVT_NODE_FAILED);
}
Thread.sleep(5000);
Ignite client = G.ignite("client-0");
UUID nodeId = client.cluster().localNode().id();
log.info("Fail coordinator: " + srvNodeId);
TestTcpDiscoverySpi srvSpi = (TestTcpDiscoverySpi) srv.configuration().getDiscoverySpi();
srvSpi.pauseAll(false);
try {
Thread.sleep(2000);
} finally {
srvSpi.simulateNodeFailure();
srvSpi.resumeAll();
}
try {
assertTrue(latch.await(failureThreshold + 3000, TimeUnit.MILLISECONDS));
assertFalse("Unexpected event, see log for details.", err.get());
assertEquals(nodeId, client.cluster().localNode().id());
} finally {
srvSpi.resumeAll();
}
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class GridSessionSetJobAttributeWaitListenerSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
c.setDiscoverySpi(discoSpi);
c.setPublicThreadPoolSize(SPLIT_COUNT * 2);
return c;
}
Aggregations