当前位置: 首页>>代码示例>>Java>>正文


Java IgniteConfiguration.setDiscoverySpi方法代码示例

本文整理汇总了Java中org.apache.ignite.configuration.IgniteConfiguration.setDiscoverySpi方法的典型用法代码示例。如果您正苦于以下问题:Java IgniteConfiguration.setDiscoverySpi方法的具体用法?Java IgniteConfiguration.setDiscoverySpi怎么用?Java IgniteConfiguration.setDiscoverySpi使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ignite.configuration.IgniteConfiguration的用法示例。


在下文中一共展示了IgniteConfiguration.setDiscoverySpi方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: helloworldConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
public static IgniteConfiguration helloworldConfiguration() {
	int cpus = Runtime.getRuntime().availableProcessors();
	IgniteConfiguration cfg = new IgniteConfiguration();
	cfg.setIgniteInstanceName("hello-world");
	cfg.setClientMode(true);
	cfg.setPeerClassLoadingEnabled(true);
	cfg.setDeploymentMode(DeploymentMode.CONTINUOUS);
	cfg.setPeerClassLoadingMissedResourcesCacheSize(200);
	cfg.setPublicThreadPoolSize(4 * cpus);
	cfg.setSystemThreadPoolSize(2 * cpus);
	// log frequency in ms
	cfg.setMetricsLogFrequency(30000);
	cfg.setGridLogger(igniteLogger());
	cfg.setDiscoverySpi(multicastDiscoverySpi());
	return cfg;
}
 
开发者ID:gauravrmazra,项目名称:gauravbytes,代码行数:17,代码来源:IgniteConfigurationHelper.java

示例2: createIgnite

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
@Bean
@Scope("singleton")
@Qualifier("operationIgniteClient")
@ConditionalOnMissingBean(KafkaOperationRepository.class)
public Ignite createIgnite(ApplicationContext applicationContext) throws IgniteCheckedException {
    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setClientMode(true);
    cfg.setPeerClassLoadingEnabled(false);
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
    ipFinder.setAddresses(Arrays.asList(clientAddress.split(",")));
    discoSpi.setIpFinder(ipFinder);
    cfg.setDiscoverySpi(discoSpi);
    cfg.setMetricsLogFrequency(0);
    return IgniteSpring.start(cfg,applicationContext);
}
 
开发者ID:kloiasoft,项目名称:eventapis,代码行数:17,代码来源:StoreApi.java

示例3: startIgnite_send

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
public static Ignite startIgnite_send(Map<String, String> group_attrs)
{

	IgniteConfiguration cfg = new IgniteConfiguration ();
	cfg.setPeerClassLoadingEnabled (true);
	// 设置群组
	cfg.setUserAttributes(group_attrs);
	//配置断点自动重连
	TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();
	
	discoverySpi.setNetworkTimeout (5000);
	
	discoverySpi.setClientReconnectDisabled(true);
	
	cfg.setDiscoverySpi(discoverySpi);
	
	return Ignition.start(cfg);
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:19,代码来源:SayHelloUtil.java

示例4: build

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
@Override
public IgniteConfiguration build() {
    IgniteConfiguration config = new IgniteConfiguration();
    config.setPeerClassLoadingEnabled(true);
    config.setClientMode(false);
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    TcpDiscoveryMulticastIpFinder ipFinder = new TcpDiscoveryMulticastIpFinder();
    ArrayList<String> addrs = new ArrayList<>();
    addrs.add("127.0.0.1:47500..47509");
    ipFinder.setAddresses(addrs);
    discoSpi.setIpFinder(ipFinder);
    config.setDiscoverySpi(discoSpi);


    CacheConfiguration accountCacheCfg = new CacheConfiguration()
            .setName("BREED")
            .setAtomicityMode(TRANSACTIONAL)
            .setIndexedTypes(
                    String.class, Breed.class
            );

    config.setCacheConfiguration(accountCacheCfg);
    return config;
}
 
开发者ID:srecon,项目名称:ignite-jpa,代码行数:25,代码来源:ConfigurationMaker.java

示例5: getDefaultIgniteConfig

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
private IgniteConfiguration getDefaultIgniteConfig(IgniteResource gridResource) {
    IgniteConfiguration igniteConfiguration = new IgniteConfiguration();
    igniteConfiguration.setGridName(getGridName(gridResource));
    igniteConfiguration.setClientMode(getClientMode(gridResource));
    igniteConfiguration.setPeerClassLoadingEnabled(getPeerClassLoadingEnabled(gridResource));

    TcpDiscoverySpi tcpDiscoverySpi = new TcpDiscoverySpi();
    TcpDiscoveryMulticastIpFinder ipFinder = new TcpDiscoveryMulticastIpFinder();
    ipFinder.setAddresses(Collections.singletonList(getIpDiscoveryRange(gridResource)));
    tcpDiscoverySpi.setIpFinder(ipFinder);
    tcpDiscoverySpi.setLocalAddress(getLocalAddress(gridResource));
    igniteConfiguration.setDiscoverySpi(tcpDiscoverySpi);

    TcpCommunicationSpi communicationSpi = new TcpCommunicationSpi();
    communicationSpi.setLocalAddress(props.getLocalAddress());
    igniteConfiguration.setCommunicationSpi(communicationSpi);

    return igniteConfiguration;
}
 
开发者ID:minlia,项目名称:ignite-spring-boot,代码行数:20,代码来源:IgniteSpringBootConfiguration.java

示例6: getConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
 * Enhances the default configuration with the {#TcpDiscoveryRedisIpFinder}.
 *
 * @param gridName Grid name.
 * @return Ignite configuration.
 * @throws Exception If failed.
 */
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration configuration = getDefaultConfiguration(gridName);

    TcpDiscoveryRedisIpFinder redisIpFinder = new TcpDiscoveryRedisIpFinder();
    redisIpFinder.setServiceName(REDIS_SERVICE_NAME);

    // first node => configure with redisConnectionString; second and subsequent
    // shall be configured through system property
    if (gridName.equals(getTestGridName(0)))
        redisIpFinder.setRedisConnectionString("localhost:16379");

    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    // Increase max missed heartbeats to avoid unexpected node fails.
    discoSpi.setMaxMissedHeartbeats(30);
    // Set heartbeat interval to 1 second to speed up tests.
    discoSpi.setHeartbeatFrequency(1000);
    // Set clean frequency to 500 milliseconds to speed up address unregistering
    discoSpi.setIpFinderCleanFrequency(500);
    discoSpi.setIpFinder(redisIpFinder);

    configuration.setDiscoverySpi(discoSpi);
    return configuration;
}
 
开发者ID:aalda,项目名称:ignite-redis,代码行数:32,代码来源:TcpDiscoveryRedisIpFinderTest.java

示例7: setUp

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
@Before
public void setUp() {
  TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
  ipFinder.setAddresses(Collections.singletonList(HOST));

  TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
  discoSpi.setIpFinder(ipFinder);

  IgniteConfiguration cfg = new IgniteConfiguration();
  cfg.setDiscoverySpi(discoSpi);

  cfg.setGridName("test");

  ignite = Ignition.start(cfg);

  Properties props = new Properties();
  props.setProperty(IgniteSqlInterpreter.IGNITE_JDBC_URL, "jdbc:ignite:cfg://[email protected]");
  props.setProperty(IgniteInterpreter.IGNITE_CLIENT_MODE, "false");
  props.setProperty(IgniteInterpreter.IGNITE_PEER_CLASS_LOADING_ENABLED, "false");

  intp = new IgniteInterpreter(props);
  intp.open();
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:24,代码来源:IgniteInterpreterTest.java

示例8: getConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    TcpDiscoverySpi disc = new TcpDiscoverySpi();
    disc.setIpFinder(IP_FINDER);

    if (igniteInstanceName.endsWith("client"))
        cfg.setClientMode(true);

    if (igniteInstanceName.endsWith("client_force_server")) {
        cfg.setClientMode(true);
        disc.setForceServerMode(true);
    }

    cfg.setDiscoverySpi(disc);

    return cfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:20,代码来源:IgniteTopologyPrintFormatSelfTest.java

示例9: getConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg =  super.getConfiguration(igniteInstanceName);

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(new TcpDiscoveryVmIpFinder(true));

    cfg.setDiscoverySpi(disco);

    CacheConfiguration ccfg = defaultCacheConfiguration();

    ccfg.setName("test-cache");
    ccfg.setCacheMode(LOCAL);
    ccfg.setCacheStoreFactory(singletonFactory(new TestStore()));
    ccfg.setReadThrough(true);
    ccfg.setWriteThrough(true);
    ccfg.setLoadPreviousValue(true);

    cfg.setCacheConfiguration(ccfg);

    return cfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:25,代码来源:GridCacheLocalLoadAllSelfTest.java

示例10: getConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    // Filling configuration for client nodes
    if (client) {
        TcpDiscoveryVmIpFinder clientFinder = new TcpDiscoveryVmIpFinder();
        Collection<String> addrs = new ArrayList<>(ipFinder.getRegisteredAddresses().size());

        for (InetSocketAddress sockAddr : ipFinder.getRegisteredAddresses())
            addrs.add(sockAddr.getHostString() + ":" + sockAddr.getPort());

        clientFinder.setAddresses(addrs);

        cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(clientFinder));

        cfg.setClientMode(true);
    }

    cfg.setLocalHost("127.0.0.1");

    return cfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:24,代码来源:GridCacheTcpClientDiscoveryMultiThreadedTest.java

示例11: apply

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
@Override
public Ignite apply(ExtendedActorSystem system) {
    final IgniteProperties properties = igniteConfigProvider.apply(system);
    final IgniteConfiguration igniteConfiguration = new IgniteConfiguration();
    igniteConfiguration.setClientMode(properties.isClientNode());
    // durable file memory persistence
    if (properties.isEnableFilePersistence()) {
        DataStorageConfiguration persistentStoreConfiguration = new DataStorageConfiguration();
        persistentStoreConfiguration.setStoragePath(properties.getIgnitePersistenceFilePath() + "/data/store");
        persistentStoreConfiguration.setWalArchivePath(properties.getIgnitePersistenceFilePath() + "./data/walArchive");
        igniteConfiguration.setDataStorageConfiguration(persistentStoreConfiguration);
    }
    // connector configuration
    final ConnectorConfiguration connectorConfiguration = new ConnectorConfiguration();
    connectorConfiguration.setPort(properties.getIgniteConnectorPort());
    // common ignite configuration
    igniteConfiguration.setMetricsLogFrequency(properties.getMetricsLogFrequency());
    igniteConfiguration.setQueryThreadPoolSize(properties.getQueryThreadPoolSize());
    igniteConfiguration.setDataStreamerThreadPoolSize(properties.getDataStreamerThreadPoolSize());
    igniteConfiguration.setManagementThreadPoolSize(properties.getManagementThreadPoolSize());
    igniteConfiguration.setPublicThreadPoolSize(properties.getPublicThreadPoolSize());
    igniteConfiguration.setSystemThreadPoolSize(properties.getSystemThreadPoolSize());
    igniteConfiguration.setRebalanceThreadPoolSize(properties.getRebalanceThreadPoolSize());
    igniteConfiguration.setAsyncCallbackPoolSize(properties.getAsyncCallbackPoolSize());
    igniteConfiguration.setPeerClassLoadingEnabled(properties.isPeerClassLoadingEnabled());

    final BinaryConfiguration binaryConfiguration = new BinaryConfiguration();
    binaryConfiguration.setCompactFooter(false);
    igniteConfiguration.setBinaryConfiguration(binaryConfiguration);
    // cluster tcp configuration
    final TcpDiscoverySpi tcpDiscoverySpi = new TcpDiscoverySpi();
    final TcpDiscoveryVmIpFinder tcpDiscoveryVmIpFinder = new TcpDiscoveryVmIpFinder();
    // need to be changed when it come to real cluster configuration
    tcpDiscoveryVmIpFinder.setAddresses(Arrays.asList(properties.getTcpDiscoveryAddresses() + properties.getIgniteServerPortRange()));
    tcpDiscoverySpi.setIpFinder(tcpDiscoveryVmIpFinder);
    igniteConfiguration.setDiscoverySpi(new TcpDiscoverySpi());
    final Ignite ignite = Ignition.start(igniteConfiguration);
    Runtime.getRuntime().addShutdownHook(new Thread(ignite::close));
    return ignite;
}
 
开发者ID:Romeh,项目名称:akka-persistance-ignite,代码行数:41,代码来源:IgniteFactoryByConfig.java

示例12: getIgniteConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
public static IgniteConfiguration getIgniteConfiguration(String gridName, boolean clientMode) {
    TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
    ipFinder.setAddresses(Collections.singletonList("127.0.0.1:47500..47509"));
    TcpDiscoverySpi tcpDiscoverySpi = new TcpDiscoverySpi();
    tcpDiscoverySpi.setIpFinder(ipFinder);
    IgniteConfiguration configuration = new IgniteConfiguration();
    configuration.setDiscoverySpi(tcpDiscoverySpi);
    configuration.setGridName(gridName);
    configuration.setClientMode(clientMode);
    return configuration;
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:12,代码来源:IgniteConfigurer.java

示例13: setNumberProcesses

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
 * Configures discovery options based by number of used grid instances.
 *
 * @param configuration base configuration.
 * @param numberOfProcesses which will be used to run test suite.
 */
public static void setNumberProcesses(IgniteConfiguration configuration, int numberOfProcesses) {
    TcpDiscoveryVmIpFinder finder = new TcpDiscoveryVmIpFinder();
    List<InetSocketAddress> addresses = new ArrayList<>();
    for (int i = 0; i < numberOfProcesses; i++) {
        addresses.add(InetSocketAddress.createUnresolved("127.0.0.1", 47500 + i));
    }
    finder.registerAddresses(addresses);
    TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();
    discoverySpi.setIpFinder(finder);
    configuration.setDiscoverySpi(discoverySpi);
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:18,代码来源:IgniteConfigHelper.java

示例14: setNumberProcesses

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
 * Configures discovery options based by number of used grid instances.
 *
 * @param configuration base configuration.
 * @param gridNumber number of started grid.
 * @param clusterSize expected size of started cluster.
 */
public static void setNumberProcesses(IgniteConfiguration configuration, int gridNumber, int clusterSize) {
    TcpDiscoveryVmIpFinder finder = new TcpDiscoveryVmIpFinder();
    List<InetSocketAddress> addresses = new ArrayList<>(clusterSize);
    for (int i = 0; i < clusterSize; i++) {
        addresses.add(InetSocketAddress.createUnresolved(LOCALHOST, BASE_PORT + i));
    }
    finder.registerAddresses(addresses);
    TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();
    discoverySpi.setIpFinder(finder);
    configuration.setDiscoverySpi(discoverySpi);
    configuration.setGridName(GRID_NAME + gridNumber);
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:20,代码来源:IgniteConfigHelper.java

示例15: startIgnite_default

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
public static Ignite startIgnite_default(Map<String, String> group_attrs,String group_key,String group_value)
{
	IgniteConfiguration cfg = new IgniteConfiguration ();
	
	cfg.setPeerClassLoadingEnabled (true);
	
	cfg.setUserAttributes (group_attrs);
	
	//配置断点自动重连
	TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();
	
	discoverySpi.setNetworkTimeout (5000);
	
	discoverySpi.setClientReconnectDisabled(true);
	
	cfg.setDiscoverySpi(discoverySpi);
	
	Ignite ignite = Ignition.start (cfg);
	
	IgniteMessaging igniteMessaging = ignite.message (ignite.cluster ().forAttribute (group_key,group_value));
	//监听的消息是接受方而不是发送方,监听的是接受这个动作而不是发送这个东作,所以其实这里填写local就可以了
	igniteMessaging.localListen ("HelloMessageComing", (nodeID, msg) ->
	{
		try
		{
			System.out.println (msg);
		}
		catch (Exception e)
		{
			e.printStackTrace ();
		}
		return true;
	});
	return ignite;
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:36,代码来源:SayHelloUtil.java


注:本文中的org.apache.ignite.configuration.IgniteConfiguration.setDiscoverySpi方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。