• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MapStoreConfig类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



MapStoreConfig类属于com.hazelcast.config包,在下文中一共展示了MapStoreConfig类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: HazelcastLockMemory

import com.hazelcast.config.MapStoreConfig; //导入依赖的package包/类
public HazelcastLockMemory(IMap<String, LockValue> locksMap) {
	super();
	this.locksMap = locksMap;
	
	LOG.info("HazelcastLockMemory ----- MAP_ID: " + locksMap.getId());
	LOG.info("HazelcastLockMemory ----- MAP_NAME: " + locksMap.getName());
	LOG.info("HazelcastLockMemory ----- MAP_STRING: " + locksMap.toString());
	LOG.info("HazelcastLockMemory ----- MAP_INSTANCE_TYPE: " + locksMap.getInstanceType());
	
	MapConfig mapConf = Hazelcast.getConfig().getMapConfig(DistributedMapNames.MAP.LOCK_MEMORY_LOCKS_MAP.toString());
	
	MapStoreConfig mapStoreConf = mapConf.getMapStoreConfig();
	
	if(mapStoreConf == null){
		LOG.info("HazelcastLockMemory ----- MAPSTORE NULL");	
	}else{
		LOG.info("HazelcastLockMemory ----- MAPSTORE IMPL: " + mapStoreConf.getImplementation());
	}
	
	
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:22,代码来源:HazelcastLockMemory.java


示例2: HazelcastFileTrackerStorage

import com.hazelcast.config.MapStoreConfig; //导入依赖的package包/类
/**
 * Requires a hazelcast map.
 * 
 * @param fileTrackerMemory
 * @param logTypeSet
 *            stores the log types
 * @param agentSet
 */
public HazelcastFileTrackerStorage(
		IMap<FileTrackingStatusKey, FileTrackingStatus> fileTrackerMemory,
		IMap<String, LogTypeContact> logTypeSet, IMap<String, AgentContact> agentSet) {

	this.fileTrackerMemoryMap = fileTrackerMemory;
	this.logTypeSet = logTypeSet;
	this.agentSet = agentSet;

	MapConfig mapConf = Hazelcast.getConfig().getMapConfig(
			DistributedMapNames.MAP.FILE_TRACKER_MAP.toString());

	MapStoreConfig mapStoreConf = mapConf.getMapStoreConfig();

	if (mapStoreConf == null) {
		LOG.info("HazelcastFileTrackerStorage ----- MAPSTORE NULL");
	} else {
		LOG.info("HazelcastFileTrackerStorage ----- MAPSTORE IMPL: "
				+ mapStoreConf.getImplementation());
	}

}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:30,代码来源:HazelcastFileTrackerStorage.java


示例3: setup

import com.hazelcast.config.MapStoreConfig; //导入依赖的package包/类
@Before
public void setup() {
    factory = new JetTestInstanceFactory();

    JetConfig config = new JetConfig();
    config.getInstanceConfig().setCooperativeThreadCount(LOCAL_PARALLELISM);

    // force snapshots to fail by adding a failing map store configuration for snapshot data maps
    MapConfig mapConfig = new MapConfig(SnapshotRepository.SNAPSHOT_DATA_NAME_PREFIX + '*');
    MapStoreConfig mapStoreConfig = mapConfig.getMapStoreConfig();
    mapStoreConfig.setEnabled(true);
    mapStoreConfig.setImplementation(new FailingMapStore());
    config.getHazelcastConfig().addMapConfig(mapConfig);

    JetInstance[] instances = factory.newMembers(config, 2);
    instance1 = instances[0];
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:18,代码来源:SnapshotFailureTest.java


示例4: setup

import com.hazelcast.config.MapStoreConfig; //导入依赖的package包/类
public DistMapConfig setup(Config cfg, String name, Object storeImplementation) {
    MapConfig mapConfig = new MapConfig();

    //TODO: Refactor the config options
    mapConfig.setName(name);
    mapConfig.setBackupCount(1);

    if (storeImplementation != null) {

        MaxSizeConfig maxSizeConfig = new MaxSizeConfig();
        //todo Refactor this to config
        maxSizeConfig.setSize(1000);

        MapStoreConfig store = new MapStoreConfig();
        store.setImplementation(storeImplementation);

        mapConfig.setMaxSizeConfig(maxSizeConfig);
        mapConfig.setMapStoreConfig(store);
    }

    cfg.addMapConfig(mapConfig);

    return this;
}
 
开发者ID:Esquive,项目名称:iticrawler,代码行数:25,代码来源:DistMapConfig.java


示例5: verify

import com.hazelcast.config.MapStoreConfig; //导入依赖的package包/类
@Verify(global = false)
public void verify() {
    if (isClient(targetInstance)) {
        return;
    }

    MapConfig mapConfig = targetInstance.getConfig().getMapConfig(name);
    logger.info(name + ": MapConfig: " + mapConfig);

    MapStoreConfig mapStoreConfig = mapConfig.getMapStoreConfig();
    logger.info(name + ": MapStoreConfig: " + mapStoreConfig);

    int sleepSeconds = mapConfig.getTimeToLiveSeconds() * 2 + mapStoreConfig.getWriteDelaySeconds() * 2;
    logger.info("Sleeping for " + sleepSeconds + " seconds to wait for delay and TTL values.");
    sleepSeconds(sleepSeconds);

    MapStoreWithCounterPerKey mapStore = (MapStoreWithCounterPerKey) mapStoreConfig.getImplementation();
    logger.info(name + ": map size = " + map.size());
    logger.info(name + ": map store = " + mapStore);

    logger.info(name + ": Checking if some keys where stored more than once");
    for (Object key : mapStore.keySet()) {
        assertEquals("There were multiple calls to MapStore.store", 1, mapStore.valueOf(key));
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-simulator,代码行数:26,代码来源:MapEvictAndStoreTest.java


示例6: create

import com.hazelcast.config.MapStoreConfig; //导入依赖的package包/类
public MapConfig create() {
	
	MapConfig mapConfig = new MapConfig();
	mapConfig.setName(HazelcastData.INVENTORY_ITEM_AGGREGATE_HISTORY.name());
	mapConfig.setInMemoryFormat(MapConfig.DEFAULT_IN_MEMORY_FORMAT);
	
	MapStoreConfig mapStoreConfig = new MapStoreConfig();
	mapStoreConfig.setImplementation(mapStore);
	mapStoreConfig.setEnabled(true);
	mapStoreConfig.setWriteDelaySeconds(writeDelaySeconds); 
	/* writeDelaySeconds > 0 means write-behind. */
	mapConfig.setMapStoreConfig(mapStoreConfig);
	
	return mapConfig;
}
 
开发者ID:rodolfodpk,项目名称:myeslib,代码行数:16,代码来源:InventoryItemMapConfigFactory.java


示例7: newConfig

import com.hazelcast.config.MapStoreConfig; //导入依赖的package包/类
protected Config newConfig(String mapName, Object storeImpl, int writeDelaySeconds) {
    Config config = new XmlConfigBuilder().build();
    MapConfig mapConfig = config.getMapConfig(mapName);
    MapStoreConfig mapStoreConfig = new MapStoreConfig();
    mapStoreConfig.setImplementation(storeImpl);
    mapStoreConfig.setWriteDelaySeconds(writeDelaySeconds);
    mapConfig.setMapStoreConfig(mapStoreConfig);
    return config;
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:10,代码来源:MapStoreTest.java


示例8: testMapRemoveWithWriteBehindMapStore

import com.hazelcast.config.MapStoreConfig; //导入依赖的package包/类
@Test
/**
 * Issue 816.
 */
public void testMapRemoveWithWriteBehindMapStore() {
    Config c = new Config();
    TestMapStore mapStore = new TestMapStore();
    mapStore.setLoadAllKeys(false);
    for (int i = 1; i < 5; i++) {
        mapStore.store(i, "value" + i);
    }
    c.getMapConfig("test").setMapStoreConfig(new MapStoreConfig().setEnabled(true)
            .setWriteDelaySeconds(100).setImplementation(mapStore));

    HazelcastInstance hz = Hazelcast.newHazelcastInstance(c);
    Map map = hz.getMap("test");

    assertEquals("value1", map.get(1));
    assertEquals("value1", map.remove(1));
    assertNull(map.get(1));

    assertEquals("value2", map.get(2));
    assertEquals("value2", map.remove(2));
    assertFalse(map.containsKey(2));

    assertEquals("value3", map.get(3));
    assertEquals("value3", map.remove(3));
    assertNull(map.put(3, "valuex"));

    assertEquals("value4", map.get(4));
    assertEquals("value4", map.remove(4));
    assertNull(map.remove(4));
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:34,代码来源:MapStoreTest.java


示例9: DistributedTableMetadataManager

import com.hazelcast.config.MapStoreConfig; //导入依赖的package包/类
public DistributedTableMetadataManager(HazelcastConnection hazelcastConnection,
                                       ElasticsearchConnection elasticsearchConnection) {
    this.hazelcastConnection = hazelcastConnection;
    MapStoreConfig mapStoreConfig = new MapStoreConfig();
    mapStoreConfig.setFactoryImplementation(TableMapStore.factory(elasticsearchConnection));
    mapStoreConfig.setEnabled(true);
    mapStoreConfig.setInitialLoadMode(MapStoreConfig.InitialLoadMode.EAGER);
    MapConfig mapConfig = new MapConfig(DATA_MAP);
    mapConfig.setMapStoreConfig(mapStoreConfig);
    mapConfig.setReadBackupData(true);
    hazelcastConnection.getHazelcastConfig().addMapConfig(mapConfig);
    DistributedCache.setupConfig(hazelcastConnection);
}
 
开发者ID:Flipkart,项目名称:foxtrot,代码行数:14,代码来源:DistributedTableMetadataManager.java


示例10: assertMapStoreConfiguration

import com.hazelcast.config.MapStoreConfig; //导入依赖的package包/类
public static void assertMapStoreConfiguration(Logger logger, HazelcastInstance instance, String mapName,
                                               Class<? extends MapStore> mapStoreImplementation) {
    if (isClient(instance)) {
        return;
    }
    String expectedMapStoreName = mapStoreImplementation.getName();
    MapStoreConfig mapStoreConfig = instance.getConfig().getMapConfig(mapName).getMapStoreConfig();
    assertMapStoreConfig(expectedMapStoreName, mapName, mapStoreConfig, logger);
    assertMapStoreClassName(expectedMapStoreName, mapName, mapStoreConfig);
    assertMapStoreImplementation(expectedMapStoreName, mapName, mapStoreConfig, mapStoreImplementation);
}
 
开发者ID:hazelcast,项目名称:hazelcast-simulator,代码行数:12,代码来源:MapStoreUtils.java


示例11: assertMapStoreConfig

import com.hazelcast.config.MapStoreConfig; //导入依赖的package包/类
private static void assertMapStoreConfig(String expectedMapStoreName, String mapName, MapStoreConfig mapStoreConfig,
                                         Logger logger) {
    if (mapStoreConfig == null) {
        throw new TestException("MapStore for map %s needs to be configured with class %s, but was not configured at all",
                mapName, expectedMapStoreName);
    }
    logger.info(format("MapStore configuration for map %s: %s", mapName, mapStoreConfig));
    if (!mapStoreConfig.isEnabled()) {
        throw new TestException("MapStore for map %s needs to be configured with class %s, but was not enabled", mapName,
                expectedMapStoreName);
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-simulator,代码行数:13,代码来源:MapStoreUtils.java


示例12: assertMapStoreClassName

import com.hazelcast.config.MapStoreConfig; //导入依赖的package包/类
private static void assertMapStoreClassName(String expectedMapStoreName, String mapName, MapStoreConfig mapStoreConfig) {
    String configuredMapStoreClassName = mapStoreConfig.getClassName();
    if (configuredMapStoreClassName == null) {
        throw new TestException("MapStore for map %s needs to be configured with class %s, but was null", mapName,
                expectedMapStoreName);
    }
    if (!expectedMapStoreName.equals(configuredMapStoreClassName)) {
        throw new TestException("MapStore for map %s needs to be configured with class %s, but was %s", mapName,
                expectedMapStoreName, configuredMapStoreClassName);
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-simulator,代码行数:12,代码来源:MapStoreUtils.java


示例13: assertMapStoreImplementation

import com.hazelcast.config.MapStoreConfig; //导入依赖的package包/类
private static void assertMapStoreImplementation(String expectedMapStoreName, String mapName, MapStoreConfig mapStoreConfig,
                                                 Class<? extends MapStore> mapStoreImplementation) {
    Object configuredMapStoreImpl = mapStoreConfig.getImplementation();
    if (configuredMapStoreImpl == null) {
        if (mapStoreConfig.getInitialLoadMode().equals(LAZY)) {
            return;
        }
        throw new TestException("MapStore for map %s needs to be initialized with class %s, but was null (%s)", mapName,
                expectedMapStoreName, mapStoreConfig);
    }
    if (!configuredMapStoreImpl.getClass().equals(mapStoreImplementation)) {
        throw new TestException("MapStore for map %s needs to be initialized with class %s, but was %s (%s)", mapName,
                expectedMapStoreName, configuredMapStoreImpl.getClass().getName(), mapStoreConfig);
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-simulator,代码行数:16,代码来源:MapStoreUtils.java


示例14: verify

import com.hazelcast.config.MapStoreConfig; //导入依赖的package包/类
@Verify(global = false)
public void verify() {
    if (isClient(targetInstance)) {
        return;
    }

    MapStoreConfig mapStoreConfig = targetInstance.getConfig().getMapConfig(name).getMapStoreConfig();
    int writeDelayMs = (int) TimeUnit.SECONDS.toMillis(mapStoreConfig.getWriteDelaySeconds());

    int sleepMs = mapStoreMaxDelayMs * 2 + maxTTLExpiryMs * 2 + (writeDelayMs * 2);
    logger.info("Sleeping for " + TimeUnit.MILLISECONDS.toSeconds(sleepMs) + " seconds to wait for delay and TTL values.");
    sleepMillis(sleepMs);

    final MapStoreWithCounter mapStore = (MapStoreWithCounter) mapStoreConfig.getImplementation();

    logger.info(name + ": map size = " + map.size());
    logger.info(name + ": map store = " + mapStore);

    assertTrueEventually(new AssertTask() {
        @Override
        public void run() throws Exception {
            for (Integer key : map.localKeySet()) {
                assertEquals(map.get(key), mapStore.get(key));
            }
            assertEquals("Map entrySets should be equal", map.getAll(map.localKeySet()).entrySet(), mapStore.entrySet());

            for (int key = putTTlKeyDomain; key < putTTlKeyDomain + putTTlKeyRange; key++) {
                assertNull(name + ": TTL key should not be in the map", map.get(key));
            }
        }
    });
}
 
开发者ID:hazelcast,项目名称:hazelcast-simulator,代码行数:33,代码来源:MapStoreTest.java


示例15: KfkaManagerImpl

import com.hazelcast.config.MapStoreConfig; //导入依赖的package包/类
public KfkaManagerImpl(HazelcastInstance hazelcastInstance, KfkaMapStore<? extends KfkaMessage> mapStore, KfkaCounterStore counterStore, KfkaConfig kfkaCfg)
{
    this.kfkaCfg = kfkaCfg;
    
    final MapConfig hzcfg = hazelcastInstance.getConfig().getMapConfig(kfkaCfg.getName());
    hzcfg.setEvictionPolicy(EvictionPolicy.NONE);
    
    final MapStoreConfig mapCfg = hzcfg.getMapStoreConfig();
    mapCfg.setImplementation(mapStore);
    mapCfg.setEnabled(kfkaCfg.isPersistent());
    mapCfg.setWriteBatchSize(kfkaCfg.getBatchSize());
    mapCfg.setWriteDelaySeconds(kfkaCfg.getWriteDelay());
    mapCfg.setInitialLoadMode(kfkaCfg.getInitialLoadMode());
    
    this.mapStore = mapStore;
    this.messages = hazelcastInstance.getMap(kfkaCfg.getName());
    this.counter = hazelcastInstance.getAtomicLong(kfkaCfg.getName());
    
    messages.addIndex("id", true);
    messages.addIndex("timestamp", true);
    
    messages.addEntryListener(new EntryAddedListener<Long, KfkaMessage>()
    {
        @Override
        public void entryAdded(EntryEvent<Long, KfkaMessage> event)
        {
        	logger.debug("Received message for dispatch: {}", event.getValue());
            final Iterator<Entry<KfkaMessageListener, KfkaPredicate>> iter = msgListeners.entrySet().iterator();
            while (iter.hasNext())
            {
            	final Entry<KfkaMessageListener, KfkaPredicate> e = iter.next();
                final KfkaPredicate predicate = e.getValue();
                final KfkaMessage msg = event.getValue();
                
                // Check if message should be included
                if (predicate.toGuavaPredicate().apply(msg))
                {
                    final KfkaMessageListener l = e.getKey();
                    logger.debug("Sending message {} to {}", event.getValue().getId(), e.getKey());
                    l.onMessage(event.getValue());
                }
            }
        }
    }, true);
    
    if (counter.get() == 0)
    {
        final long initialValue = counterStore.latest();
        logger.info("Setting current KFKA message ID counter to {}", initialValue);
        counter.compareAndSet(0, initialValue);
    }
}
 
开发者ID:ethlo,项目名称:kfka,代码行数:53,代码来源:KfkaManagerImpl.java


示例16: main

import com.hazelcast.config.MapStoreConfig; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException {
  final Config cfg = new Config();
  cfg.setInstanceName(UUID.randomUUID().toString());

  final Properties props = new Properties();
  props.put("hazelcast.rest.enabled", false);
  props.put("hazelcast.logging.type", "slf4j");
  props.put("hazelcast.connect.all.wait.seconds", 45);
  props.put("hazelcast.operation.call.timeout.millis", 30000);

  // group configuration
  cfg.setGroupConfig(new GroupConfig(args[0],
      args[1]));
  // network configuration initialization
  final NetworkConfig netCfg = new NetworkConfig();
  netCfg.setPortAutoIncrement(true);
  netCfg.setPort(5701);
  // multicast
  final MulticastConfig mcCfg = new MulticastConfig();
  mcCfg.setEnabled(false);
  // tcp
  final TcpIpConfig tcpCfg = new TcpIpConfig();
  tcpCfg.addMember("127.0.0.1");
  tcpCfg.setEnabled(true);
  // network join configuration
  final JoinConfig joinCfg = new JoinConfig();
  joinCfg.setMulticastConfig(mcCfg);
  joinCfg.setTcpIpConfig(tcpCfg);
  netCfg.setJoin(joinCfg);
  // ssl
  netCfg.setSSLConfig(new SSLConfig().setEnabled(false));

  // creating cassandra client
  final CassandraClient dao = new CassandraClient();
  dao.initialize(args[2]);

  final HazelcastMapStore mapStore = new HazelcastMapStore(User.class);
  mapStore.setDao(dao);


  // Adding mapstore
  final MapConfig mapCfg = cfg.getMapConfig("cassandra-map-store");

  final MapStoreConfig mapStoreCfg = new MapStoreConfig();
  mapStoreCfg.setImplementation(mapStore);
  mapStoreCfg.setWriteDelaySeconds(1);
  // to load all map at same time
  mapStoreCfg.setInitialLoadMode(MapStoreConfig.InitialLoadMode.EAGER);
  mapCfg.setMapStoreConfig(mapStoreCfg);
  cfg.addMapConfig(mapCfg);


  HazelcastInstance instance = Hazelcast.newHazelcastInstance(cfg);

  // TERM signal processing
  Runtime.getRuntime().addShutdownHook(new Thread(() -> {
    Hazelcast.shutdownAll();
  }));
}
 
开发者ID:FlavioF,项目名称:docker-hazelcast-mapstore-cassandra,代码行数:60,代码来源:InstanceStart.java


示例17: getConfig

import com.hazelcast.config.MapStoreConfig; //导入依赖的package包/类
public Config getConfig() {

    final Config cfg = new Config();
    cfg.setInstanceName(instanceName);

    final Properties props = new Properties();
    props.put("hazelcast.rest.enabled", false);
    props.put("hazelcast.logging.type", "slf4j");
    props.put("hazelcast.connect.all.wait.seconds", 45);
    props.put("hazelcast.operation.call.timeout.millis", 30000);

    // group configuration
    cfg.setGroupConfig(new GroupConfig(Constants.HC_GROUP_NAME,
        Constants.HC_GROUP_PASSWORD));
    // network configuration initialization
    final NetworkConfig netCfg = new NetworkConfig();
    netCfg.setPortAutoIncrement(true);
    netCfg.setPort(Constants.HC_PORT);
    // multicast
    final MulticastConfig mcCfg = new MulticastConfig();
    mcCfg.setEnabled(false);
    // tcp
    final TcpIpConfig tcpCfg = new TcpIpConfig();
    tcpCfg.addMember("127.0.0.1");
    tcpCfg.setEnabled(true);
    // network join configuration
    final JoinConfig joinCfg = new JoinConfig();
    joinCfg.setMulticastConfig(mcCfg);
    joinCfg.setTcpIpConfig(tcpCfg);
    netCfg.setJoin(joinCfg);
    // ssl
    netCfg.setSSLConfig(new SSLConfig().setEnabled(false));

    // Adding mapstore
    final MapConfig mapCfg = cfg.getMapConfig(storeType);

    final MapStoreConfig mapStoreCfg = new MapStoreConfig();
    mapStoreCfg.setImplementation(store);
    mapStoreCfg.setWriteDelaySeconds(1);
    // to load all map at same time
    mapStoreCfg.setInitialLoadMode(MapStoreConfig.InitialLoadMode.EAGER);
    mapCfg.setMapStoreConfig(mapStoreCfg);
    cfg.addMapConfig(mapCfg);
    return cfg;
  }
 
开发者ID:FlavioF,项目名称:hazelcast-mapstore-postgres-cassandra,代码行数:46,代码来源:MyHazelcastInstance.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DNSRecordClass类代码示例发布时间:2022-05-22
下一篇:
Java GL33类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap