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


Java IgniteConfiguration.setClientMode方法代码示例

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


在下文中一共展示了IgniteConfiguration.setClientMode方法的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: 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

示例4: 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

示例5: startNodes

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
protected void startNodes(CountDownLatch activateLatch) throws Exception {
    IgniteConfiguration cfg1 = getConfiguration(node1)
        .setCacheConfiguration(ccfg1static, ccfg1staticWithFilter);

    IgniteConfiguration cfg2 = getConfiguration(node2)
        .setCacheConfiguration(ccfg2static, ccfg2staticWithFilter);

    IgniteConfiguration cfg3 = getConfiguration(nodeClient)
        .setCacheConfiguration(ccfg3static, ccfg3staticWithFilter);

    if (activateLatch != null)
        cfg3.setDiscoverySpi(
            new AwaitTcpDiscoverySpi(activateLatch)
                .setIpFinder(clientIpFinder)
        );

    cfg3.setClientMode(true);

    IgniteEx ig1 = startGrid(cfg1);
    IgniteEx ig2 = startGrid(cfg2);
    IgniteEx client = startGrid(cfg3);
}
 
开发者ID:apache,项目名称:ignite,代码行数:23,代码来源:IgniteAbstractStandByClientReconnectTest.java

示例6: 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

示例7: 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

示例8: createConfig

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
private IgniteConfiguration createConfig() {
	IgniteConfiguration config = new IgniteConfiguration();
	config.setClientMode( false );
	BinaryConfiguration binaryConfiguration = new BinaryConfiguration();
	binaryConfiguration.setNameMapper( new BinaryBasicNameMapper( true ) );
	binaryConfiguration.setCompactFooter( false );		// it is necessary only for embedded collections (@ElementCollection)
	config.setBinaryConfiguration( binaryConfiguration );
	TransactionConfiguration transactionConfiguration = new TransactionConfiguration();
	transactionConfiguration.setDefaultTxConcurrency( TransactionConcurrency.OPTIMISTIC );
	transactionConfiguration.setDefaultTxIsolation( TransactionIsolation.READ_COMMITTED );
	config.setTransactionConfiguration( transactionConfiguration );

	return config;
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:15,代码来源:IgniteTestConfigurationBuilder.java

示例9: getIgnite

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
private Ignite getIgnite() {
  if (ignite == null) {
    try {
      String cfgUrl = getProperty(IGNITE_CFG_URL);

      if (cfgUrl != null && !cfgUrl.isEmpty()) {
        ignite = Ignition.start(new URL(cfgUrl));
      } else {
        IgniteConfiguration conf = new IgniteConfiguration();

        conf.setClientMode(Boolean.parseBoolean(getProperty(IGNITE_CLIENT_MODE)));

        TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
        ipFinder.setAddresses(getAddresses());

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

        conf.setPeerClassLoadingEnabled(
                Boolean.parseBoolean(getProperty(IGNITE_PEER_CLASS_LOADING_ENABLED)));

        ignite = Ignition.start(conf);
      }

      initEx = null;
    } catch (Exception e) {
      initEx = e;
    }
  }
  return ignite;
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:33,代码来源:IgniteInterpreter.java

示例10: main

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
public static void main(String[] args) {
    System.out.println("Hello Ignite");
    // create a new instance of TCP Discovery SPI
    TcpDiscoverySpi spi = new TcpDiscoverySpi();
    // create a new instance of tcp discovery multicast ip finder
    TcpDiscoveryMulticastIpFinder tcMp = new TcpDiscoveryMulticastIpFinder();
    tcMp.setAddresses(Arrays.asList("localhost")); // change your IP address here
    // set the multi cast ip finder for spi
    spi.setIpFinder(tcMp);
    // create new ignite configuration
    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setClientMode(false);
    // set the discovery spi to ignite configuration
    cfg.setDiscoverySpi(spi);
    // Start ignite
    Ignite ignite = Ignition.start(cfg);
    // get or create cache
    IgniteCache<Integer, String> cache = ignite.getOrCreateCache("testCache");
    // put some cache elements
    for(int i = 1; i <= 100; i++){
        cache.put(i, Integer.toString(i));
    }
    // get them from the cache and write to the console
    for(int i =1; i<= 100; i++){
        System.out.println("Cache get:"+ cache.get(i));
    }
    ignite.close();

}
 
开发者ID:srecon,项目名称:ignite-book-code-samples,代码行数:30,代码来源:HelloIgnite.java

示例11: main

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
public static void main(String[] args) {
    System.out.println("Hello Ignite Asynchronous!!");
    // create a new instance of TCP Discovery SPI
    TcpDiscoverySpi spi = new TcpDiscoverySpi();
    // create a new instance of tcp discovery multicast ip finder
    TcpDiscoveryMulticastIpFinder tcMp = new TcpDiscoveryMulticastIpFinder();
    tcMp.setAddresses(Arrays.asList("localhost")); // change your IP address here
    // set the multi cast ip finder for spi
    spi.setIpFinder(tcMp);
    // create new ignite configuration
    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setClientMode(false);
    // set the discovery spi to ignite configuration
    cfg.setDiscoverySpi(spi);
    // Start ignite
    Ignite ignite = Ignition.start(cfg);

    // get or create cache
    IgniteCache<Integer, String> cache = ignite.getOrCreateCache("testCache");
    // get an asynchronous cache
    IgniteCache<Integer, String> asynCache = cache.withAsync();

    // put some cache elements
    for(int i = 1; i <= 100; i++){
        cache.put(i, Integer.toString(i));
    }

    String val = asynCache.withAsync().get(1);
    System.out.println("Non future call:" + val);
    IgniteFuture<String> igniteFuture = asynCache.future();



    igniteFuture.listen(f-> System.out.println("Cache Value:" + f.get()));
    ignite.close();

}
 
开发者ID:srecon,项目名称:ignite-book-code-samples,代码行数:38,代码来源:HelloIgniteAsyn.java

示例12: getIgnite

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
private Ignite getIgnite() {
  if (ignite == null) {
    try {
      String cfgUrl = getProperty(IGNITE_CFG_URL);

      if (cfgUrl != null && !cfgUrl.isEmpty()) {
        ignite = Ignition.start(new URL(cfgUrl));
      } else {
        IgniteConfiguration conf = new IgniteConfiguration();

        conf.setClientMode(Boolean.parseBoolean(getProperty(IGNITE_CLIENT_MODE)));

        TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
        ipFinder.setAddresses(getAddresses());

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

        conf.setPeerClassLoadingEnabled(
                Boolean.parseBoolean(getProperty(IGNITE_PEER_CLASS_LOADING_ENABLED)));

        ignite = Ignition.start(conf);
      }

      initEx = null;
    } catch (Exception e) {
      logger.error("Error in IgniteInterpreter while getIgnite: " , e);
      initEx = e;
    }
  }
  return ignite;
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:34,代码来源:IgniteInterpreter.java

示例13: getConfiguration

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

    cfg.setClientMode(clientMode);

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

示例14: getConfiguration

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

    if (getTestIgniteInstanceIndex(gridName) == 0)
        cfg.setClientMode(true);

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

示例15: getConfiguration

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

    if (cilent)
        cfg.setClientMode(true);

    if (cache) {
        CacheConfiguration cacheCfg = defaultCacheConfiguration();

        cacheCfg.setCacheMode(PARTITIONED);
        cacheCfg.setBackups(1);
        cacheCfg.setRebalanceMode(SYNC);
        cacheCfg.setAtomicityMode(TRANSACTIONAL);

        cfg.setCacheConfiguration(cacheCfg);
    }

    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();

    discoSpi.setForceServerMode(true);
    discoSpi.setIpFinder(IP_FINDER);

    cfg.setDiscoverySpi(discoSpi);

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


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