當前位置: 首頁>>代碼示例>>Java>>正文


Java TcpDiscoveryIpFinder類代碼示例

本文整理匯總了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);
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:21,代碼來源:GridCacheNearReaderPreloadSelfTest.java

示例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;
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:34,代碼來源:GridCacheNearReaderPreloadSelfTest.java

示例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;
}
 
開發者ID:gauravrmazra,項目名稱:gauravbytes,代碼行數:6,代碼來源:IgniteConfigurationHelper.java

示例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);
    }
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:57,代碼來源:BasicWarmupClosure.java

示例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;
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:24,代碼來源:TcpDiscoveryNodeAttributesUpdateOnReconnectTest.java

示例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;
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:20,代碼來源:TcpDiscoverySslSecuredUnsecuredTest.java

示例7: getIpFinder

import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; //導入依賴的package包/類
/**
 * @return IP finder.
 */
@GridSpiTestConfig
public TcpDiscoveryIpFinder getIpFinder() {
    return new TcpDiscoveryVmIpFinder(true);
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:8,代碼來源:TcpDiscoverySpiStartStopSelfTest.java

示例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());
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:21,代碼來源:OptimizedMarshallerTest.java

示例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);
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:67,代碼來源:IgfsAbstractBaseSelfTest.java

示例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;
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:16,代碼來源:TcpDiscoverySpi.java

示例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());
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:17,代碼來源:OptimizedMarshallerTest.java

示例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;
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:9,代碼來源:TcpDiscoverySpi.java


注:本文中的org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。