本文整理汇总了Java中com.hazelcast.config.CacheSimpleConfig类的典型用法代码示例。如果您正苦于以下问题:Java CacheSimpleConfig类的具体用法?Java CacheSimpleConfig怎么用?Java CacheSimpleConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CacheSimpleConfig类属于com.hazelcast.config包,在下文中一共展示了CacheSimpleConfig类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import com.hazelcast.config.CacheSimpleConfig; //导入依赖的package包/类
@Before
public void setup() {
JetConfig jetConfig = new JetConfig();
Config hazelcastConfig = jetConfig.getHazelcastConfig();
hazelcastConfig.addCacheConfig(new CacheSimpleConfig().setName("*"));
hazelcastConfig.addEventJournalConfig(new EventJournalConfig().setCacheName("stream*").setMapName("stream*"));
jetInstance = createJetMember(jetConfig);
JetInstance jetInstance2 = createJetMember(jetConfig);
sourceName = randomString();
sinkName = randomString();
streamSourceName = "stream" + sourceName;
streamSinkName = "stream" + sinkName;
// workaround for `cache is not created` exception, create cache locally on all nodes
JetCacheManager cacheManager = jetInstance2.getCacheManager();
cacheManager.getCache(sourceName);
cacheManager.getCache(sinkName);
cacheManager.getCache(streamSourceName);
cacheManager.getCache(streamSinkName);
}
示例2: setupCluster
import com.hazelcast.config.CacheSimpleConfig; //导入依赖的package包/类
@BeforeClass
public static void setupCluster() throws Exception {
int parallelism = Runtime.getRuntime().availableProcessors() / MEMBER_COUNT / 2;
JetConfig config = new JetConfig();
config.getInstanceConfig().setCooperativeThreadCount(parallelism <= 2 ? 2 : parallelism);
Config hzConfig = config.getHazelcastConfig();
hzConfig.addCacheConfig(new CacheSimpleConfig().setName("*"));
hzConfig.getMapEventJournalConfig(JOURNALED_MAP_PREFIX + '*').setEnabled(true);
member = createCluster(MEMBER_COUNT, config);
client = factory.newClient();
}
示例3: before
import com.hazelcast.config.CacheSimpleConfig; //导入依赖的package包/类
@Before
public void before() {
JetConfig jetConfig = new JetConfig();
Config hazelcastConfig = jetConfig.getHazelcastConfig();
hazelcastConfig.addCacheConfig(new CacheSimpleConfig().setName("*"));
factory = new JetTestInstanceFactory();
jet = factory.newMember(jetConfig);
JetInstance jet2 = factory.newMember(jetConfig);
Config config = new Config();
config.addCacheConfig(new CacheSimpleConfig().setName("*"));
config.addEventJournalConfig(new EventJournalConfig().setCacheName("default").setMapName("default"));
hz = Hazelcast.newHazelcastInstance(config);
HazelcastInstance hz2 = Hazelcast.newHazelcastInstance(config);
clientConfig = new ClientConfig();
clientConfig.getGroupConfig().setName("dev");
clientConfig.getGroupConfig().setPassword("dev-pass");
Address address = hz.getCluster().getLocalMember().getAddress();
clientConfig.getNetworkConfig().addAddress(address.getHost() + ':' + address.getPort());
// workaround for `cache is not created` exception, create cache locally on all nodes
jet2.getCacheManager().getCache(SOURCE_NAME);
jet2.getCacheManager().getCache(SINK_NAME);
hz2.getCacheManager().getCache(SOURCE_NAME);
hz2.getCacheManager().getCache(SINK_NAME);
}