本文整理了Java中com.hazelcast.config.Config.setLicenseKey()
方法的一些代码示例,展示了Config.setLicenseKey()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.setLicenseKey()
方法的具体详情如下:
包路径:com.hazelcast.config.Config
类名称:Config
方法名:setLicenseKey
[英]Sets the license key for this hazelcast instance. The license key is used to enable enterprise features.
[中]设置此hazelcast实例的许可证密钥。许可证密钥用于启用企业功能。
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public Config setLicenseKey(String licenseKey) {
return staticConfig.setLicenseKey(licenseKey);
}
代码示例来源:origin: com.hazelcast/hazelcast-all
@Override
public Config setLicenseKey(String licenseKey) {
return staticConfig.setLicenseKey(licenseKey);
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private static Config newConfig() {
Config config = new Config();
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
return config;
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static void main(String[] args) throws Exception {
SSLConfig sslConfig = new SSLConfig();
sslConfig.setEnabled(true);
sslConfig.setFactoryClassName("com.hazelcast.nio.ssl.BasicSSLContextFactory");
sslConfig.setProperty("keyStore", new File("hazelcast.ks").getAbsolutePath());
sslConfig.setProperty("keyStorePassword", "password");
sslConfig.setProperty("javax.net.ssl.trustStore", new File("hazelcast.ts").getAbsolutePath());
Config config = new Config();
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
config.getNetworkConfig().setSSLConfig(sslConfig);
HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);
System.out.println("Hazelcast Member instance is running!");
BlockingQueue<String> queue = hz.getQueue("queue");
for (; ; ) {
System.out.println(queue.take());
}
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private static Config createConfig() {
Config config = new Config();
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
config.setProperty("hazelcast.wait.seconds.before.join", "0");
SocketInterceptorConfig interceptorConfig = new SocketInterceptorConfig();
interceptorConfig.setEnabled(true).setClassName(MySocketInterceptor.class.getName());
config.getNetworkConfig().setSocketInterceptorConfig(interceptorConfig);
return config;
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private static Config createConfig() {
Config config = new Config();
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
config.setProperty("hazelcast.wait.seconds.before.join", "0");
SocketInterceptorConfig interceptorConfig = new SocketInterceptorConfig();
interceptorConfig.setEnabled(true).setClassName(MySocketInterceptor.class.getName());
config.getNetworkConfig().setSocketInterceptorConfig(interceptorConfig);
return config;
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private static Config createConfig() {
return new Config()
.setLicenseKey(ENTERPRISE_LICENSE_KEY)
.setNativeMemoryConfig(createMemoryConfig())
.setSerializationConfig(createSerializationConfig());
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
@Override
protected Config createConfig() {
NativeMemoryConfig nativeMemoryConfig = new NativeMemoryConfig()
.setSize(SERVER_NATIVE_MEMORY_SIZE)
.setEnabled(true);
return super.createConfig()
.setLicenseKey(ENTERPRISE_LICENSE_KEY)
.setNativeMemoryConfig(nativeMemoryConfig);
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private EnterpriseCacheTestServer(String memory) {
this.memorySize = MemorySize.parse(memory, MemoryUnit.GIGABYTES);
InputStream configInputStream = EnterpriseCacheTestServer.class.getResourceAsStream("/hazelcast-hd-memory.xml");
Config config = new XmlConfigBuilder(configInputStream).build();
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
NativeMemoryConfig memoryConfig = config.getNativeMemoryConfig();
if (!memoryConfig.isEnabled()) {
memoryConfig.setSize(memorySize).setEnabled(true);
memoryConfig.setAllocatorType(NativeMemoryConfig.MemoryAllocatorType.POOLED);
}
instance = Hazelcast.newHazelcastInstance(config);
memoryStats = MemoryStatsUtil.getMemoryStats(instance);
logger = instance.getLoggingService().getLogger(EnterpriseCacheTestServer.class);
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private static Config createConfig() {
Config config = new Config();
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
config.setProperty("hazelcast.wait.seconds.before.join", "0");
SecurityInterceptorConfig securityInterceptorConfig = new SecurityInterceptorConfig();
securityInterceptorConfig.setClassName(MySecurityInterceptor.class.getName());
SecurityConfig securityConfig = config.getSecurityConfig();
securityConfig.setEnabled(true).addSecurityInterceptorConfig(securityInterceptorConfig);
// when you enable security all client requests are denied, so we need to give permission first
// security-interceptor will be run after checking this permission
PermissionConfig permissionConfig = new PermissionConfig(PermissionConfig.PermissionType.ALL, "", null);
securityConfig.addClientPermissionConfig(permissionConfig);
return config;
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private static HazelcastInstance newHazelcastInstance(int port) {
Config config = new Config();
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
config.getNetworkConfig().setPort(port).setPortAutoIncrement(false);
JoinConfig join = config.getNetworkConfig().getJoin();
join.getMulticastConfig().setEnabled(false);
join.getTcpIpConfig().setEnabled(true).clear()
.addMember("127.0.0.1:5701")
.addMember("127.0.0.1:5702");
HotRestartPersistenceConfig hotRestartConfig = config.getHotRestartPersistenceConfig();
hotRestartConfig.setEnabled(true).setBaseDir(new File(HOT_RESTART_ROOT_DIR + port));
return Hazelcast.newHazelcastInstance(config);
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private static HazelcastInstance newHazelcastInstance(int port) {
Config config = new Config();
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
config.getNetworkConfig().setPort(port).setPortAutoIncrement(false);
JoinConfig join = config.getNetworkConfig().getJoin();
join.getMulticastConfig().setEnabled(false);
join.getTcpIpConfig().setEnabled(true).clear()
.addMember("127.0.0.1:5701")
.addMember("127.0.0.1:5702");
HotRestartPersistenceConfig hotRestartConfig = config.getHotRestartPersistenceConfig();
hotRestartConfig.setEnabled(true).setBaseDir(new File(HOT_RESTART_ROOT_DIR + port));
return Hazelcast.newHazelcastInstance(config);
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static void main(String[] args) {
IOUtil.delete(new File(HOT_RESTART_ROOT_DIR));
Config config = new Config();
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
config.getNetworkConfig().setPort(5701).setPortAutoIncrement(false);
JoinConfig join = config.getNetworkConfig().getJoin();
join.getMulticastConfig().setEnabled(false);
join.getTcpIpConfig().setEnabled(true).clear().addMember("127.0.0.1");
HotRestartPersistenceConfig hotRestartConfig = config.getHotRestartPersistenceConfig();
hotRestartConfig.setEnabled(true).setBaseDir(new File(HOT_RESTART_ROOT_DIR));
HazelcastInstance instance = Hazelcast.newHazelcastInstance(config);
Cache<Integer, String> cache = createCache(instance);
for (int i = 0; i < 10; i++) {
cache.put(i, "value" + i);
}
instance.shutdown();
instance = Hazelcast.newHazelcastInstance(config);
cache = createCache(instance);
for (int i = 0; i < 10; i++) {
System.out.println("cache.get(" + i + ") = " + cache.get(i));
}
Hazelcast.shutdownAll();
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private Config getConfigClusterA() {
Config config = new Config();
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
config.getGroupConfig().setName("clusterA").setPassword("clusterA-pass");
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true).addMember("127.0.0.1:5701");
config.setInstanceName("clusterA");
config.getNetworkConfig().setPort(5701);
config.setClassLoader(createCacheManagerClassLoader());
WanReplicationConfig wanReplicationConfig = new WanReplicationConfig();
wanReplicationConfig.setName("AtoB");
WanPublisherConfig publisherConfigClusterB = new WanPublisherConfig();
publisherConfigClusterB.setClassName(WanBatchReplication.class.getName());
publisherConfigClusterB.setGroupName("clusterB");
Map<String, Comparable> props = publisherConfigClusterB.getProperties();
props.put(WanReplicationProperties.ENDPOINTS.key(), "127.0.0.1:5702");
props.put(WanReplicationProperties.GROUP_PASSWORD.key(), "clusterB-pass");
// setting acknowledge type is optional, defaults to ACK_ON_OPERATION_COMPLETE
props.put(WanReplicationProperties.ACK_TYPE.key(), WanAcknowledgeType.ACK_ON_OPERATION_COMPLETE.name());
wanReplicationConfig.addWanPublisherConfig(publisherConfigClusterB);
config.addWanReplicationConfig(wanReplicationConfig);
WanReplicationRef wanReplicationRef = new WanReplicationRef();
wanReplicationRef.setName("AtoB");
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
wanReplicationRef.setMergePolicy(HigherHitsCacheMergePolicy.class.getName());
wanReplicationRef.addFilter(SampleCacheWanEventFilter.class.getName());
config.getCacheConfig("default").setWanReplicationRef(wanReplicationRef);
return config;
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private static Config getConfigClusterB() {
Config config = new Config();
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
config.getGroupConfig().setName("clusterB").setPassword("clusterB-pass");
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true).addMember("127.0.0.1:5702");
return config;
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static Config newConfig() {
MapConfig mapConfig = new MapConfig();
mapConfig.setName("default");
mapConfig.setInMemoryFormat(InMemoryFormat.NATIVE);
MemorySize memorySize = new MemorySize(128, MemoryUnit.MEGABYTES);
NativeMemoryConfig memoryConfig = new NativeMemoryConfig();
memoryConfig.setEnabled(true);
memoryConfig.setSize(memorySize);
memoryConfig.setAllocatorType(NativeMemoryConfig.MemoryAllocatorType.STANDARD);
Config config = new Config();
config.addMapConfig(mapConfig);
config.setNativeMemoryConfig(memoryConfig);
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
return config;
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private Config getConfigClusterB() {
Config config = new Config();
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
config.getGroupConfig().setName("clusterB").setPassword("clusterB-pass");
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true).addMember("127.0.0.1:5702");
config.setInstanceName("clusterB");
config.getNetworkConfig().setPort(5702);
config.setClassLoader(createCacheManagerClassLoader());
return config;
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static Config newConfig() {
MaxSizeConfig maxSizeConfig = new MaxSizeConfig();
maxSizeConfig.setMaxSizePolicy(PER_NODE);
maxSizeConfig.setSize(MAX_ENTRY_COUNT);
MapConfig mapConfig = new MapConfig();
mapConfig.setName("default");
mapConfig.setInMemoryFormat(InMemoryFormat.NATIVE);
mapConfig.setEvictionPolicy(EvictionPolicy.LRU);
mapConfig.setMaxSizeConfig(maxSizeConfig);
mapConfig.setMinEvictionCheckMillis(0);
MemorySize memorySize = new MemorySize(128, MemoryUnit.MEGABYTES);
NativeMemoryConfig memoryConfig = new NativeMemoryConfig();
memoryConfig.setEnabled(true);
memoryConfig.setSize(memorySize);
memoryConfig.setAllocatorType(NativeMemoryConfig.MemoryAllocatorType.STANDARD);
Config config = new Config();
config.addMapConfig(mapConfig);
config.setNativeMemoryConfig(memoryConfig);
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
return config;
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private static Config newConfig() {
NearCacheConfig nearCacheConfig = new NearCacheConfig();
EvictionConfig evictionConfig = nearCacheConfig.getEvictionConfig();
evictionConfig.setMaximumSizePolicy(USED_NATIVE_MEMORY_PERCENTAGE);
evictionConfig.setSize(90);
nearCacheConfig.setInMemoryFormat(NATIVE);
nearCacheConfig.setInvalidateOnChange(true);
nearCacheConfig.setCacheLocalEntries(true);
nearCacheConfig.setName("default");
MapConfig mapConfig = new MapConfig();
mapConfig.setName("default");
mapConfig.setNearCacheConfig(nearCacheConfig);
NativeMemoryConfig memoryConfig = new NativeMemoryConfig();
memoryConfig.setEnabled(true);
memoryConfig.setSize(new MemorySize(128, MEGABYTES));
memoryConfig.setAllocatorType(STANDARD);
Config config = new Config();
config.addMapConfig(mapConfig);
config.setNativeMemoryConfig(memoryConfig);
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
return config;
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
handleMemberAttributes(node);
} else if (LICENSE_KEY.isEqual(nodeName)) {
config.setLicenseKey(getTextContent(node));
} else if (MANAGEMENT_CENTER.isEqual(nodeName)) {
handleManagementCenterConfig(node);
内容来源于网络,如有侵权,请联系作者删除!