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


Java Config.addMapConfig方法代码示例

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


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

示例1: init

import com.hazelcast.config.Config; //导入方法依赖的package包/类
@PostConstruct
public void init() {
	Config config = this.hazelcastInstance.getConfig();
	String mapName = this.sessionProperties.getMapName();
	MapConfig mapConfig = config.getMapConfigOrNull(mapName);

	if (mapConfig == null) {
		// @formatter:off
		MapAttributeConfig principalNameAttributeConfig = new MapAttributeConfig()
				.setName(HazelcastSessionRepository.PRINCIPAL_NAME_ATTRIBUTE)
				.setExtractor(PrincipalNameExtractor.class.getName());
		// @formatter:on

		MapIndexConfig principalNameIndexConfig = new MapIndexConfig(
				HazelcastSessionRepository.PRINCIPAL_NAME_ATTRIBUTE, false);

		// @formatter:off
		mapConfig = new MapConfig(mapName)
				.addMapAttributeConfig(principalNameAttributeConfig)
				.addMapIndexConfig(principalNameIndexConfig);
		// @formatter:on

		config.addMapConfig(mapConfig);
	}
}
 
开发者ID:vpavic,项目名称:simple-openid-provider,代码行数:26,代码来源:SessionConfiguration.java

示例2: init

import com.hazelcast.config.Config; //导入方法依赖的package包/类
public void init() {

        //Specific map time to live
        MapConfig myMapConfig = new MapConfig();
        myMapConfig.setName("cachetest");
        myMapConfig.setTimeToLiveSeconds(10);

        //Package config
        Config myConfig = new Config();
        myConfig.addMapConfig(myMapConfig);

        //Symmetric Encryption
        SymmetricEncryptionConfig symmetricEncryptionConfig = new SymmetricEncryptionConfig();
        symmetricEncryptionConfig.setAlgorithm("DESede");
        symmetricEncryptionConfig.setSalt("saltysalt");
        symmetricEncryptionConfig.setPassword("lamepassword");
        symmetricEncryptionConfig.setIterationCount(1337);

        //Weak Network config..
        NetworkConfig networkConfig = new NetworkConfig();
        networkConfig.setSymmetricEncryptionConfig(symmetricEncryptionConfig);

        myConfig.setNetworkConfig(networkConfig);

        Hazelcast.init(myConfig);

        cacheMap = Hazelcast.getMap("cachetest");
    }
 
开发者ID:blackarbiter,项目名称:Android_Code_Arbiter,代码行数:29,代码来源:HazelcastSymmetric.java

示例3: hazelcastInstance

import com.hazelcast.config.Config; //导入方法依赖的package包/类
@Bean
public HazelcastInstance hazelcastInstance() {
    Config config = new Config();

    if (zkEnabled) {
        addZkConfig(config);
    }

    config.addMapConfig(createDeviceCredentialsCacheConfig());

    return Hazelcast.newHazelcastInstance(config);
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:13,代码来源:ServiceCacheConfiguration.java

示例4: Transport

import com.hazelcast.config.Config; //导入方法依赖的package包/类
/**
 * Initializes the {@link HazelcastInstance} for this global runtime instance.
 *
 * @param runtime
 *          the global runtime instance
 * @param master
 *          member to connect to or null
 * @param localhost
 *          the preferred ip address of this host or null
 * @param compact
 *          reduce thread creation if set
 * @param kryo
 *          use kryo serialization if set
 */
protected Transport(GlobalRuntimeImpl runtime, String master,
    String localhost, boolean compact, boolean kryo) {
  this.runtime = runtime;
  // config
  final Config config = new Config();
  config.setProperty("hazelcast.logging.type", "none");
  config.setProperty("hazelcast.wait.seconds.before.join", "0");
  config.setProperty("hazelcast.socket.connect.timeout.seconds", "1");
  config.setProperty("hazelcast.connection.monitor.max.faults", "0");
  if (compact) {
    config.setProperty("hazelcast.operation.thread.count", "2");
    config.setProperty("hazelcast.operation.generic.thread.count", "2");
    config.setProperty("hazelcast.io.thread.count", "2");
    config.setProperty("hazelcast.event.thread.count", "2");
    config.addExecutorConfig(
        new ExecutorConfig(ExecutionService.ASYNC_EXECUTOR, 2));
    config.addExecutorConfig(
        new ExecutorConfig(ExecutionService.SYSTEM_EXECUTOR, 2));
    config.addExecutorConfig(
        new ExecutorConfig(ExecutionService.SCHEDULED_EXECUTOR, 2));
  }

  // kryo
  if (kryo) {
    config.getSerializationConfig().addSerializerConfig(
        new SerializerConfig().setTypeClass(SerializableRunnable.class)
            .setImplementation(new KryoSerializer()));
  }

  config.addMapConfig(
      new MapConfig(APGAS_FINISH).setInMemoryFormat(InMemoryFormat.OBJECT));

  // join config
  final JoinConfig join = config.getNetworkConfig().getJoin();
  join.getMulticastConfig().setEnabled(false);
  join.getTcpIpConfig().setEnabled(true);
  if (localhost != null) {
    System.setProperty("hazelcast.local.localAddress", localhost);
  }
  if (master != null) {
    join.getTcpIpConfig().addMember(master);
  }
  config.setInstanceName(APGAS);

  hazelcast = Hazelcast.newHazelcastInstance(config);
  me = hazelcast.getCluster().getLocalMember();

  allMembers = hazelcast.getList(APGAS_PLACES);
  allMembers.add(me);
  int id = 0;
  for (final Member member : allMembers) {
    if (member.getUuid().equals(me.getUuid())) {
      break;
    }
    ++id;
  }
  here = id;

  executor = hazelcast.getExecutorService(APGAS_EXECUTOR);
}
 
开发者ID:x10-lang,项目名称:apgas,代码行数:75,代码来源:Transport.java

示例5: givenMemberHasClassLoaderConfigured_whenObjectIsStored_thenClassLoaderWillBeUsed

import com.hazelcast.config.Config; //导入方法依赖的package包/类
@Test
public void givenMemberHasClassLoaderConfigured_whenObjectIsStored_thenClassLoaderWillBeUsed() throws Exception {
    String mapName = randomMapName();
    Config config = new Config();
    SubZero.useAsGlobalSerializer(config);
    ClassLoader spyingClassLoader = createSpyingClassLoader();
    config.setClassLoader(spyingClassLoader);
    config.addMapConfig(new MapConfig(mapName).setInMemoryFormat(OBJECT));
    HazelcastInstance member = hazelcastFactory.newHazelcastInstance(config);
    IMap<Integer, Object> myMap = member.getMap(mapName);

    myMap.put(0, new MyClass());

    verify(spyingClassLoader).loadClass("info.jerrinot.subzero.ClassLoadingTest$MyClass");
}
 
开发者ID:jerrinot,项目名称:subzero,代码行数:16,代码来源:ClassLoadingTest.java

示例6: configureCache

import com.hazelcast.config.Config; //导入方法依赖的package包/类
/**
 * Add configuration for an {@link IMap} that will contain the event window.
 * @param eventWindowName The name of the {@link IMap} to configure.
 * @param timeToLiveSeconds The number of seconds to keep an event's identity in the window before discarding it.
 * @param config The {@link Config} to add the {@link IMap} configuration to.
 * @return The updated {@link Config}
 */
public static Config configureCache(String eventWindowName, int timeToLiveSeconds, Config config) {
    config.addMapConfig(new MapConfig(eventWindowName).setTimeToLiveSeconds(timeToLiveSeconds));
    return config;
}
 
开发者ID:opencredo,项目名称:concursus,代码行数:12,代码来源:IdempotentEventFilter.java


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