use of org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder in project ignite by apache.
the class OptimizedMarshallerTest method testNonSerializable1.
/**
* Tests ability to marshal non-serializable objects.
*
* @throws IgniteCheckedException If marshalling failed.
*/
@Test
public void testNonSerializable1() throws IgniteCheckedException {
OptimizedMarshaller marsh = marshaller();
marsh.setRequireSerializable(false);
byte[] bytes = marsh.marshal(new TcpDiscoveryVmIpFinder());
TcpDiscoveryIpFinder ipFinder = marsh.unmarshal(bytes, null);
assertFalse(ipFinder.isShared());
ipFinder = marsh.unmarshal(marsh.marshal(new TcpDiscoveryVmIpFinder(true)), null);
assertTrue(ipFinder.isShared());
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder in project ignite by apache.
the class OptimizedMarshallerTest method testNonSerializable3.
/**
* Tests ability to marshal non-serializable objects.
*
* @throws IgniteCheckedException If marshalling failed.
*/
@Test
public void testNonSerializable3() throws IgniteCheckedException {
OptimizedMarshaller marsh = marshaller();
marsh.setRequireSerializable(false);
byte[] bytes = marsh.marshal(new TestTcpDiscoveryIpFinderAdapter());
TcpDiscoveryIpFinder ipFinder = marsh.unmarshal(bytes, null);
assertFalse(ipFinder.isShared());
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder in project ignite by apache.
the class IgniteExchangeLatchManagerDiscoHistoryTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoveryIpFinder ipFinder = ((TcpDiscoverySpi) cfg.getDiscoverySpi()).getIpFinder();
int topHistSize = victim ? TOPOLOGY_HISTORY_SIZE : TcpDiscoverySpi.DFLT_TOP_HISTORY_SIZE;
CustomTcpDiscoverySpi discoSpi = new CustomTcpDiscoverySpi(topHistSize, ipFinder);
cfg.setDiscoverySpi(discoSpi);
if (victim) {
cfg.setFailureHandler(new AbstractFailureHandler() {
/**
* {@inheritDoc}
*/
@Override
protected boolean handle(Ignite ignite, FailureContext failureCtx) {
cpFailureCtx.compareAndSet(null, failureCtx);
// Invalidate kernel context.
return true;
}
});
cfg.setLifecycleBeans(lifecycleBean);
disco = discoSpi;
}
return cfg;
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder in project ignite by apache.
the class BasicWarmupClosure method apply.
/**
* {@inheritDoc}
*/
@Override
public void apply(IgniteConfiguration gridCfg) {
// Remove cache duplicates, clean up the rest, etc.
IgniteConfiguration cfg = prepareConfiguration(gridCfg);
// Do nothing if no caches found.
if (cfg == null)
return;
out("Starting grids to warmup caches [gridCnt=" + gridCnt + ", caches=" + cfg.getCacheConfiguration().length + ']');
Collection<Ignite> ignites = new LinkedList<>();
String old = System.getProperty(IgniteSystemProperties.IGNITE_UPDATE_NOTIFIER);
try {
System.setProperty(IgniteSystemProperties.IGNITE_UPDATE_NOTIFIER, "false");
TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
for (int i = 0; i < gridCnt; i++) {
IgniteConfiguration cfg0 = new IgniteConfiguration(cfg);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(ipFinder);
discoSpi.setLocalPort(discoveryPort);
cfg0.setDiscoverySpi(discoSpi);
cfg0.setGridLogger(new NullLogger());
cfg0.setIgniteInstanceName("ignite-warmup-grid-" + i);
ignites.add(Ignition.start(cfg0));
}
doWarmup(ignites);
} catch (Exception e) {
throw new IgniteException(e);
} finally {
for (Ignite ignite : ignites) Ignition.stop(ignite.name(), false);
out("Stopped warmup grids.");
if (old == null)
old = "false";
System.setProperty(IgniteSystemProperties.IGNITE_UPDATE_NOTIFIER, old);
}
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder in project ignite by apache.
the class TcpDiscoveryNodeAttributesUpdateOnReconnectTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
if (gridName.contains("client")) {
Map<String, String> attrs = new HashMap<>();
attrs.put("test", "1");
cfg.setUserAttributes(attrs);
}
IgniteClientReconnectAbstractTest.TestTcpDiscoverySpi spi = new IgniteClientReconnectAbstractTest.TestTcpDiscoverySpi();
TcpDiscoveryIpFinder finder = ((TcpDiscoverySpi) cfg.getDiscoverySpi()).getIpFinder();
spi.setIpFinder(finder);
cfg.setDiscoverySpi(spi);
cfg.setPluginProviders(new TestReconnectSecurityPluginProvider());
return cfg;
}
Aggregations