本文整理汇总了Java中org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder类的典型用法代码示例。如果您正苦于以下问题:Java TcpDiscoveryIpFinder类的具体用法?Java TcpDiscoveryIpFinder怎么用?Java TcpDiscoveryIpFinder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TcpDiscoveryIpFinder类属于org.apache.ignite.spi.discovery.tcp.ipfinder包,在下文中一共展示了TcpDiscoveryIpFinder类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startUp
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; //导入依赖的package包/类
/**
* Startup routine.
*
* @throws Exception If failed.
*/
private void startUp() throws Exception {
TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
Ignite node1 = G.start(dataNode(ipFinder, "node1"));
Ignite node2 = G.start(dataNode(ipFinder, "node2"));
Ignite node3 = G.start(dataNode(ipFinder, "node3"));
info("Node 1: " + node1.cluster().localNode().id());
info("Node 2: " + node2.cluster().localNode().id());
info("Node 3: " + node3.cluster().localNode().id());
cache1 = node1.cache(CACHE_NAME);
cache2 = node2.cache(CACHE_NAME);
cache3 = node3.cache(CACHE_NAME);
}
示例2: dataNode
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; //导入依赖的package包/类
/**
* Create configuration for data node.
*
* @param ipFinder IP finder.
* @param igniteInstanceName Ignite instance name.
* @return Configuration for data node.
* @throws IgniteCheckedException If failed.
*/
private IgniteConfiguration dataNode(TcpDiscoveryIpFinder ipFinder, String igniteInstanceName)
throws Exception {
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setName(CACHE_NAME);
ccfg.setCacheMode(PARTITIONED);
ccfg.setAtomicityMode(TRANSACTIONAL);
ccfg.setNearConfiguration(new NearCacheConfiguration());
ccfg.setWriteSynchronizationMode(FULL_SYNC);
ccfg.setBackups(1);
IgniteConfiguration cfg = getConfiguration(igniteInstanceName);
TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setIpFinder(ipFinder);
cfg.setLocalHost("127.0.0.1");
cfg.setDiscoverySpi(spi);
cfg.setCacheConfiguration(ccfg);
cfg.setIncludeProperties();
cfg.setConnectorConfiguration(null);
return cfg;
}
示例3: multicastIpFinder
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; //导入依赖的package包/类
private static TcpDiscoveryIpFinder multicastIpFinder() {
TcpDiscoveryMulticastIpFinder ipFinder = new TcpDiscoveryMulticastIpFinder();
ipFinder.setAddresses(Collections.singletonList("localhost:47500"));
return ipFinder;
}
示例4: apply
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; //导入依赖的package包/类
/** {@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);
}
}
示例5: getConfiguration
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; //导入依赖的package包/类
/** {@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);
cfg.setClientMode(true);
}
IgniteClientReconnectAbstractTest.TestTcpDiscoverySpi spi = new IgniteClientReconnectAbstractTest.TestTcpDiscoverySpi();
TcpDiscoveryIpFinder finder = ((TcpDiscoverySpi)cfg.getDiscoverySpi()).getIpFinder();
spi.setIpFinder(finder);
cfg.setDiscoverySpi(spi);
return cfg;
}
示例6: getConfiguration
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(final String gridName) throws Exception {
final IgniteConfiguration cfg = super.getConfiguration(gridName);
cfg.setClientMode(gridName.contains("client"));
if (gridName.contains("ssl"))
cfg.setSslContextFactory(GridTestUtils.sslFactory());
if (spi != null) {
final TcpDiscoveryIpFinder finder = ((TcpDiscoverySpi)cfg.getDiscoverySpi()).getIpFinder();
spi.setIpFinder(finder);
cfg.setDiscoverySpi(spi);
}
return cfg;
}
示例7: getIpFinder
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; //导入依赖的package包/类
/**
* @return IP finder.
*/
@GridSpiTestConfig
public TcpDiscoveryIpFinder getIpFinder() {
return new TcpDiscoveryVmIpFinder(true);
}
示例8: testNonSerializable1
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; //导入依赖的package包/类
/**
* Tests ability to marshal non-serializable objects.
*
* @throws IgniteCheckedException If marshalling failed.
*/
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());
}
示例9: startGridWithIgfs
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; //导入依赖的package包/类
/**
* Start grid with IGFS.
*
* @param igniteInstanceName Ignite instance name.
* @param igfsName IGFS name
* @param mode IGFS mode.
* @param secondaryFs Secondary file system (optional).
* @param restCfg Rest configuration string (optional).
* @param ipFinder IP finder.
* @return Started grid instance.
* @throws Exception If failed.
*/
@SuppressWarnings("unchecked")
protected Ignite startGridWithIgfs(String igniteInstanceName, String igfsName, IgfsMode mode,
@Nullable IgfsSecondaryFileSystem secondaryFs, @Nullable IgfsIpcEndpointConfiguration restCfg,
TcpDiscoveryIpFinder ipFinder) throws Exception {
FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
igfsCfg.setName(igfsName);
igfsCfg.setBlockSize(IGFS_BLOCK_SIZE);
igfsCfg.setDefaultMode(mode);
igfsCfg.setIpcEndpointConfiguration(restCfg);
igfsCfg.setSecondaryFileSystem(secondaryFs);
igfsCfg.setPrefetchBlocks(PREFETCH_BLOCKS);
igfsCfg.setSequentialReadsBeforePrefetch(SEQ_READS_BEFORE_PREFETCH);
igfsCfg.setRelaxedConsistency(relaxedConsistency());
igfsCfg.setFragmentizerEnabled(fragmentizerEnabled());
CacheConfiguration dataCacheCfg = defaultCacheConfiguration();
dataCacheCfg.setNearConfiguration(null);
dataCacheCfg.setCacheMode(PARTITIONED);
dataCacheCfg.setNearConfiguration(null);
dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(2));
dataCacheCfg.setBackups(0);
dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
CacheConfiguration metaCacheCfg = defaultCacheConfiguration();
metaCacheCfg.setNearConfiguration(null);
metaCacheCfg.setCacheMode(REPLICATED);
metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
metaCacheCfg.setAtomicityMode(TRANSACTIONAL);
prepareCacheConfigurations(dataCacheCfg, metaCacheCfg);
igfsCfg.setDataCacheConfiguration(dataCacheCfg);
igfsCfg.setMetaCacheConfiguration(metaCacheCfg);
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setIgniteInstanceName(igniteInstanceName);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(discoSpi);
cfg.setFileSystemConfiguration(igfsCfg);
cfg.setLocalHost("127.0.0.1");
cfg.setConnectorConfiguration(null);
return G.start(cfg);
}
示例10: setIpFinder
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; //导入依赖的package包/类
/**
* Sets IP finder for IP addresses sharing and storing.
* <p>
* If not provided {@link org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder} will
* be used by default.
*
* @param ipFinder IP finder.
* @return {@code this} for chaining.
*/
@IgniteSpiConfiguration(optional = true)
public TcpDiscoverySpi setIpFinder(TcpDiscoveryIpFinder ipFinder) {
this.ipFinder = ipFinder;
return this;
}
示例11: testNonSerializable3
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; //导入依赖的package包/类
/**
* Tests ability to marshal non-serializable objects.
*
* @throws IgniteCheckedException If marshalling failed.
*/
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());
}
示例12: getIpFinder
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; //导入依赖的package包/类
/**
* Gets IP finder for IP addresses sharing and storing.
*
* @return IP finder for IP addresses sharing and storing.
*/
public TcpDiscoveryIpFinder getIpFinder() {
return ipFinder;
}