本文整理匯總了Java中com.hazelcast.config.MapConfig.setName方法的典型用法代碼示例。如果您正苦於以下問題:Java MapConfig.setName方法的具體用法?Java MapConfig.setName怎麽用?Java MapConfig.setName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.hazelcast.config.MapConfig
的用法示例。
在下文中一共展示了MapConfig.setName方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setup
import com.hazelcast.config.MapConfig; //導入方法依賴的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;
}
示例2: testEvictedEntryNotNullAfterLockAndGet
import com.hazelcast.config.MapConfig; //導入方法依賴的package包/類
/**
* Test for Issue 710
*/
@Test
public void testEvictedEntryNotNullAfterLockAndGet() throws Exception {
String mapName = "testLock";
Config config = new XmlConfigBuilder().build();
MapConfig mapConfig = new MapConfig();
mapConfig.setName(mapName);
mapConfig.setTimeToLiveSeconds(3);
config.addMapConfig(mapConfig);
HazelcastInstance h1 = Hazelcast.newHazelcastInstance(config);
IMap<Object, Object> m1 = h1.getMap(mapName);
m1.put(1, 1);
assertEquals(1, m1.get(1));
Thread.sleep(5000);
assertEquals(null, m1.get(1));
m1.lock(1);
assertEquals(null, m1.get(1));
m1.put(1, 1);
assertEquals(1, m1.get(1));
}
示例3: init
import com.hazelcast.config.MapConfig; //導入方法依賴的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");
}
示例4: HazelcastApp
import com.hazelcast.config.MapConfig; //導入方法依賴的package包/類
public HazelcastApp(String name, int id) {
this.id = id;
Config config = new Config();
MapConfig mapConfig = new MapConfig();
mapConfig.setName("nodes");
mapConfig.addEntryListenerConfig(new EntryListenerConfig(MapEntryListener.class.getCanonicalName(), false, true));
config.addMapConfig(mapConfig);
config.setInstanceName(name + id);
hazelcastInstance = Hazelcast.newHazelcastInstance(config);
}
示例5: create
import com.hazelcast.config.MapConfig; //導入方法依賴的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;
}
示例6: testUseBackupDataGet
import com.hazelcast.config.MapConfig; //導入方法依賴的package包/類
@Test
public void testUseBackupDataGet() throws Exception {
final Config config = new Config();
final MapConfig mapConfig = new MapConfig();
mapConfig.setName("q");
mapConfig.setReadBackupData(true);
config.setMapConfigs(Collections.singletonMap(mapConfig.getName(), mapConfig));
HazelcastInstance h1 = Hazelcast.newHazelcastInstance(config);
HazelcastInstance h2 = Hazelcast.newHazelcastInstance(config);
h1.getMap("q").put("q", "Q");
Thread.sleep(50L);
final IMap<Object, Object> map2 = h2.getMap("q");
assertEquals("Q", map2.get("q"));
}
示例7: testUseBackupDataGet
import com.hazelcast.config.MapConfig; //導入方法依賴的package包/類
@Test
public void testUseBackupDataGet() throws Exception {
final Config config = new Config();
final MapConfig mapConfig = new MapConfig();
mapConfig.setName("q");
mapConfig.setReadBackupData(true);
config.setMapConfigs(Collections.singletonMap(mapConfig.getName(), mapConfig));
HazelcastInstance h1 = Hazelcast.newHazelcastInstance(config);
HazelcastInstance h2 = Hazelcast.newHazelcastInstance(config);
h1.getMap("q").put("q", "Q");
Thread.sleep(50L);
HazelcastClient client = newHazelcastClient(h2);
assertEquals("Q", client.getMap("q").get("q"));
}